Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Today i learned (12/2/2015)
- <!--bring special class to body tag-->
- <?php body_class(); ?>
- example:
- <body <?php body_class(); ?>> </body>
- =====================================================================================
- <!--Dynamic Logo-->
- <a href="#">My blog</a>
- <a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a>
- =====================================================================================
- <!--Admin bar hide-->
- /*into functions.php*/
- <?php
- add_filter('show_admin_bar', '__return_false');
- ?>
- =====================================================================================
- front-page.php
- =====================================================================================
- <title><?php wp_title( '|', true, 'right' ); ?> <?php bloginfo('name'); ?></title>
- =====================================================================================
- /*
- For fevicon
- */
- <?php bloginfo('template_directory'); ?>
- <link rel="icon" href="../../favicon.ico">
- <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/images/favicon.ico">
- =====================================================================================
- /*
- For footer
- */
- <p> © Company 2014</p>
- <p> © <?php bloginfo('name'); ?> <?php echo date('Y'); ?></p>
- =====================================================================================
- /*
- html 5 shiv
- */
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- <?php
- function theme_js() {
- global $wp_scripts;
- wp_register_script('html5_shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', '', '', false);
- wp_register_script('respond_js', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', '', '', false);
- $wp_scripts->add_data('html5_shiv', 'conditional', 'lt IE 9');
- $wp_scripts->add_data('respond_js', 'conditional', 'lt IE 9');
- wp_enqueue_script('bootstrap_js', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery'), '', true);
- }
- add_action('wp_enqueue_scripts', 'theme_js');
- ?>
- =====================================================================================
- /*
- Bootstrap shortcode plugin
- */
- https://wordpress.org/plugins/bootstrap-shortcodes/
- =====================================================================================
- <!--About meta tag-->
- <meta name="author" content="null">
- <meta name="description" content="null">
- /*
- install these plugins for author and description dynamic
- */
- https://wordpress.org/plugins/google-plus-authorship/
- https://wordpress.org/plugins/wordpress-seo/
- =====================================================================================
- /**/
- * শর্টকোডগুলি tinymce button দিয়ে কাজ করে। এখন widget এর মধ্যে শর্টকোড লিখার সময় tinymce button কোথায় পাবো? tinymce button না পেলে admin কিভাবে widget এর মধ্যে শর্টকোড লিখবে?
- ans: install this plugin
- https://wordpress.org/plugins/black-studio-tinymce-widget/
- then "visual" editor will appear on widget
- =====================================================================================
- /* for page php */
- <?php get_sidebar(); ?>
- sidebar.php
- /* another sidebar for blog*/
- <?php get_sidebar( 'blog' ); ?>
- sidebar-blog.php
- =====================================================================================
- full width page
- page-full-width.php
- <?php
- /*
- Template Name: Full Width Template
- */
- ?>
- =====================================================================================
- home.php is blog php
- page.php কে কপি এবং রিনেম করে home.php করতে হবে।
- তাহলে wordpress home.php কে blog.php হিসাবে শনাক্ত করবে।
- settings>reading>
- front-page> Home & post-page> blog
- post-page> blog সিলেক্ট করার কারনে home.php template থেকেই blog post হবে
- =====================================================================================
- <?php wp_title(''); ?>
- Example:
- <div class="page_header">
- <h1><?php wp_title(''); ?></h1>
- </div>
- কোন পেজের হেডার এর টাইটেল হিসাবে এটি ব্যবহৃত হবে।
- =====================================================================================
- /*
- the_author, the_time, the_category
- */
- By Ornob, on Wednesday, April 9th, 2014 in Featured, News No Comments
- <p>
- By <?php the_author(); ?>
- on <?php echo the_time('l, F jS, Y'); ?>
- in <?php the_category( ', ' ); ?>
- <a href="<?php comments_link(); ?>"><?php comments_number(); ?></a>
- </p>
- =====================================================================================
- /*comments_template for comments option of post comment single page underneath the post */
- <?php comments_template(); ?>
- =====================================================================================
- home.php কে কপি করে archive.php তৈরি করতে হবে।
- =====================================================================================
- Custom Post Type UI
- https://wordpress.org/plugins/custom-post-type-ui/
- Advanced Custom Fields
- https://wordpress.org/plugins/advanced-custom-fields/
- =====================================================================================
- /*dynamically added row break*/
- <?php $portfolio_count = $the_query->current-post + 1; ?>
- <?php if($portfolio_count % 4 = 0) : ?>
- </div><div class="row">
- <?php endif; ?>
- /*another*/
- <?php $q = new WP_Query( array( 'posts_per_page' => 6 ) ); // Edit your query ?>
- <?php if( $q->have_posts() ) : ?>
- <?php while ( $q->have_posts() ) : $q->the_post(); ?>
- <?php if( 0 === ( $q->current_post ) % 3 ): ?>
- <!--Begin Row:--> <div class="row" data-equalizer>
- <?php endif; ?>
- <!--Item: -->
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <?php get_template_part( 'partials/loop', 'archive-grid' ); ?>
- </div>
- <?php if( 0 === ( $q->current_post + 1 ) % 3 || ( $q->current_post + 1 ) === $q->post_count ): ?>
- <!--End Row: --> </div>
- <?php endif; ?>
- <?php endwhile; ?>
- <?php wp_reset_postdata(); ?>
- <?php else : ?>
- <?php get_template_part( 'partials/content', 'missing' ); ?>
- <?php endif; ?>
- This should give you the following layouts with three items per row:
- #posts: 1
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- #posts: 2
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- #posts: 3
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- You can use the following built-in properties of the WP_Query() class:
- WP_Query::current_post // Index of the current post, starts at 0
- WP_Query::found_posts // The total number of posts found
- WP_Query::post_count // The number of posts being displayed.
- to make your life eaiser, instead of introducing custom counters.
- Here's an example that works on my install:
- <?php $q = new WP_Query( array( 'posts_per_page' => 6 ) ); // Edit your query ?>
- <?php if( $q->have_posts() ) : ?>
- <?php while ( $q->have_posts() ) : $q->the_post(); ?>
- <?php if( 0 === ( $q->current_post ) % 3 ): ?>
- <!--Begin Row:--> <div class="row" data-equalizer>
- <?php endif; ?>
- <!--Item: -->
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <?php get_template_part( 'partials/loop', 'archive-grid' ); ?>
- </div>
- <?php if( 0 === ( $q->current_post + 1 ) % 3 || ( $q->current_post + 1 ) === $q->post_count ): ?>
- <!--End Row: --> </div>
- <?php endif; ?>
- <?php endwhile; ?>
- <?php wp_reset_postdata(); ?>
- <?php else : ?>
- <?php get_template_part( 'partials/content', 'missing' ); ?>
- <?php endif; ?>
- This should give you the following layouts with three items per row:
- #posts: 1
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- #posts: 2
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- #posts: 3
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- and
- #posts: 4
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- <div class="row" data-equalizer>
- <div class="large-4 medium-4 columns" data-equalizer-watch>
- <--Content Stuff-->
- </div>
- </div>
- /*another*/
- <?php /* Template Name: Page TOP movies */ get_header(); ?>
- <div class="container">
- <div class="row">
- <div class="col-lg-12">
- <div class="page-header">
- <h1 id="type">TOP filmai</h1>
- </div>
- </div>
- </div>
- <?php
- //Set the counter to 1
- $i = 1;
- //Open the row div
- echo '<div class="row"><div class="movie_list">'; ?>
- <?php $custom_query = new WP_Query( array( 'posts_per_page' => 24, 'meta_key' => 'wpb_post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) );
- while($custom_query->have_posts()) : $custom_query->the_post(); ?>
- <div class="col-md-2">
- <div class="well">
- <h6><a href="<?php the_permalink();?>"><?php if (strlen($post->post_title) > 35) {
- echo substr(the_title($before = '', $after = '', FALSE), 0, 25) . '...'; } else {
- the_title();
- } ?></a></h6>
- <a href="<?php the_permalink();?>"><?php the_post_thumbnail('movie-thumb', array('class' => 'img-thumbnail')); ?></a>
- <a href="<?php the_permalink();?>"><button type="button" class="btn btn-default btn-sm btn-block"><span class="glyphicon glyphicon-play"></span> Žiūrėti</button></a>
- </div>
- </div>
- <?php $i++; if($i % 6 == 0) {echo '</div></div><div class="row"><div class="movie_list">'; ?>
- <?php } ?>
- <?php endwhile; ?>
- </div></div>
- <?php wp_reset_postdata(); // reset the query ?>
- <?php get_footer(); ?>
- /*another*/
- <div class="row">
- <?php
- $args = array('post_type' => 'portfolio');
- $the_query = new WP_Query($args);
- ?>
- <?php if(have_posts()) : while( $the_query->have_posts()) : $the_query->the_post(); ?>
- <div class="col-sm-3 portfolio-piece">
- <?php
- $thumbnail_id = get_post_thumbnail_id();
- $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true);
- ?>
- <img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title(); ?>" />
- <h3><?php the_title(); ?></h3>
- </div>
- <!--dynamic row break code after 4 post-->
- <?php $portfolio_count = $the_query->current-post + 1; ?>
- <?php if($portfolio_count % 4 = 0) : ?>
- </div><div class="row">
- <!--every 4 posts close div and open new div with class </row>-->
- <?php endif; ?>
- <?php endwhile; endif; ?>
- </div>
- =====================================================================================
- /*
- custom single page
- */
- default post গুলি শো হবে single.php থেকে।
- আর custom post গুলি শো হবে single-(custom_post).php থেকে।
- Example: Custom post is : "portfolio"
- single-portfolio.php
- =====================================================================================
- <?php next_posts_link('%link', 'Left'); ?>
- <?php previous_posts_link('%link', 'right'); ?>
- all portfolio url
- <span><a href="<?php bloginfo('url'); ?>/?p=68"></a></span>
- =====================================================================================
- <?php the_field('link'); ?>
- <a href="<?php the_field('link'); ?>"></a>
- =====================================================================================
- /*loop*/
- <?php
- $args = array('post_type' = 'post', 'category_name' => 'featured');
- $the_query = new WP_Query($args);
- ?>
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <?php endwhile; endif; ?>
- =====================================================================================
- /*rewind post*/
- <?php rewind_post(); ?>
- =====================================================================================
- /*bootstrap carousel slider dynamic*/
- /*Original mark up*/
- <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
- <!-- Indicators -->
- <ol class="carousel-indicators">
- <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
- <li data-target="#carousel-example-generic" data-slide-to="1"></li>
- <li data-target="#carousel-example-generic" data-slide-to="2"></li>
- </ol>
- <!-- Wrapper for slides -->
- <div class="carousel-inner" role="listbox">
- <div class="item active">
- <img src="..." alt="...">
- <div class="carousel-caption">
- ...
- </div>
- </div>
- <div class="item">
- <img src="..." alt="...">
- <div class="carousel-caption">
- ...
- </div>
- </div>
- ...
- </div>
- <!-- Controls -->
- <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
- <span class="sr-only">Previous</span>
- </a>
- <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
- <span class="sr-only">Next</span>
- </a>
- </div>
- /*Dynamic mark up*/
- /*
- if it is equal to 0 and if it is,
- it will going to display "active" class
- and if it is not equal to 0 then it will not display anything
- */
- <?php
- $args = array('post_type' = 'post', 'category_name' => 'featured');
- $the_query = new WP_Query($args);
- ?>
- <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
- <!-- Indicators -->
- <ol class="carousel-indicators">
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <li data-target="#carousel-example-generic" data-slide-to="<?php echo $the_query->current_post; ?>" class="<?php if($the_query->current_post = 0) : ?>active<?php endif; ?>"></li>
- <?php endwhile; endif; ?>
- </ol>
- <?php rewind_post(); ?>
- <!-- Wrapper for slides -->
- <div class="carousel-inner" role="listbox">
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <div class="item <?php if($the_query->current_post = 0) : ?>active<?php endif; ?>">
- <?php
- $thumbnail_id = get_post_thumbnail_id();
- $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true);
- $thumbnail_meta = get_post_meta($thumbnail_id, 'wp_get_attachment_image_alt', true);
- ?>
- <img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php echo $thumbnail_meta; ?>">
- <div class="carousel-caption"> <?php the_title(); ?></div>
- </div>
- <?php endwhile; endif; ?>
- </div>
- <!-- Controls -->
- <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
- <span class="sr-only">Previous</span>
- </a>
- <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
- <span class="sr-only">Next</span>
- </a>
- </div>
- =====================================================================================
- /*Modal window*/
- /*Modal form*/
- /* ninja forms plugin */
- =====================================================================================
- Building Websites with Bootstrap 3
- HTML Tables
- HTML Forms
- HTML Video and Audio
- New Features in CSS
- How to Use Google Analytics
- SEO Basics
- How to Make a Favicon
- Using PHP with MySQL
- =====================================================================================
- /*
- custom post query for one page theme
- */
- <?php
- $args = array('post_type' => 'page', 'order' => 'ASC');
- $the_query = new WP_Query($args);
- ?>
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <?php get_template_part( 'content', 'page'); ?>
- <?php endwhile; endif; ?>
- =====================================================================================
- <?php get_template_part( 'content', 'page'); ?>
- its meaning
- content-page.php
- <?php get_template_part( 'content'); ?>
- its meaning
- content.php
- =====================================================================================
- <?php echo $post->post_name; ?>
- =====================================================================================
- <?php
- global $post;
- ?>
- <article id="<?php echo $post->post_name; ?>">
- </article><!-- #post-## -->
- =====================================================================================
- jquery scroll to
- =====================================================================================
- <script type="text/javascript">
- $("#button").click(function() {
- $('html, body').animate({
- scrollTop: $("#elementtoScrollToID").offset().top
- }, 2000);
- });
- </script>
- <script type="text/javascript">
- ( function( $ ) {
- $("nav a").click(function() {
- /* "nav a" বলতে কোন অংশের উপর ক্লিক করতে হবে, সেটা বোঝানো হয়েছে */
- var link = $(this).attr('href');
- $('html, body').animate({
- scrollTop: $(link).offset().top
- /* link বলতে কোন এলিমেন্টের উপর scrollTop কাজ করবে, সেটা বোঝানো হয়েছে */
- }, 1000);
- });
- } )( jQuery );
- </script>
- <script type="text/javascript">
- ( function( $ ) {
- $("nav a").click(function() {
- var link = $(this).attr('href');
- $('html, body').animate({
- scrollTop: $(link).offset().top
- }, 1000);
- });
- } )( jQuery );
- </script>
- =====================================================================================
- steps--->
- --> install (one_page_theme)underscores.me theme
- --> add custom css
- --> 4 page created : Home, Portfolio, About me, Contact
- --> Front page display> static page> Home
- --> copy and duplicate page.php > rename one-page-site.php
- /**
- * Template Name: One page site
- */
- --> /*use wp query into one page site*/
- <?php
- $args = array('post_type' => 'page', 'order' => 'ASC', 'orderby' => 'menu_order');
- $the_query = new WP_Query($args);
- ?>
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <?php get_template_part( 'content', 'page'); ?>
- <?php endwhile; endif; ?>
- -->Now all 4 page will be displayed in one page
- --><?php get_template_part( 'content', 'page'); ?> its meaning content-page.php
- -->Bring slug name as page post id
- use slug name to post id
- example:
- id="<?php the_ID(); ?>"
- /*change*/
- <?php
- global $post;
- ?>
- id="<?php echo $post->post_name; ?>"
- -->now check its working or not
- address+#portfolio
- -->But menu navigation is not selected yet
- now menu need use # tag instead of url
- delete default menu
- use Links: Link text-> Home, URL-> #home
- here: #home is post slug name
- -->Now i have to use smooth scroll for menu
- add theme.js and into it
- <script type="text/javascript">
- ( function( $ ) {
- $("nav a").click(function() {
- var link = $(this).attr('href');
- $('html, body').animate({
- scrollTop: $(link).offset().top
- }, 1000);
- });
- } )( jQuery );
- </script>
- <div class="single_n text-center">
- <div class="col-xs-3 col-sm-3 col-lg-2 news_area">
- <a href="'.$link.'">
- <img alt="" class="img-responsive" data-src="" src="'.$newsimage[0].'" data-holder-rendered="true">
- <h4>'.get_the_title().'</h4>
- </a>
- </div>
- </div>
- [np_post count="" category=""]
- 04_02-Using custom queries to display content from different pages
- কাস্টম ফিল্ডে বাটনের লিংক দিতে পারি নি, কাস্টম ফিল্ড কাজ করে না
- শর্টকোডে ওয়ার্ডপ্রেস ডিফল্ট পোস্টের ক্যাটাগরি আনতে পারি নি
- one page html theme : front page এ একটা লিংক থাকবে, ঐ লিংকটা তে গেলে অন্য একটা পেজে যাবে, এবং ঐ পেজে ঐ বিষয়ের ডিটেইলস দেখাবে, এটা করতে পারিনি
- http://codex.wordpress.org/Theme_Development
- 16/feb/2015
- child theme
- original theme folder name twentyfifteen
- child theme foldername হবে twentyfifteen-child
- অবস্থান হবে original theme folder এর পাশের folder
- folder এর মধ্যে style.css নামে file তৈরি করতে হবে
- style.css এর মধ্যে লিখতে হবে
- /*
- Theme Name: Twenty Fifteen Child
- Theme URI: http://example.com/twenty-fifteen-child/
- Description: Twenty Fifteen Child Theme
- Author: John Doe
- Author URI: http://example.com
- Template: twentyfifteen
- Version: 1.0.0
- License: GNU General Public License v2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
- Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
- Text Domain: twenty-fifteen-child
- */
- যে file টি পরিবর্তন হবে সেটা parent folder থেকে child theme folder এর মধ্যে কপি করে আনতে হবে
- copy header.php > then edit
- functions.php কপি
- parent theme এর functions.php কল করতে হবে
- <?php
- require_once(get_stylesheet_directory().'/functions.php');
- ?>
- details:
- http://codex.wordpress.org/Child_Themes
- child theme (lander) এর style.css এর মধ্যে parent theme এর style.css import করতে হবে
- @import url('../simone/style.css');
- .. ->jump out to the lander folder
- /simone in to the simone folder
- then load style.css
- এবার theme এ গিয়ে child theme active করতে হবে
- one page theme এ front page হিসাবে front-page.php কে show করাতে হবে
- front-page.php এর মধ্যে 4 টি section লিখা হলো
- call to action
- services
- meet the doctor
- contact us
- lander-style.css নামে একটা new file তৈরি করা হলো lander folder এর মধ্যে
- functions.php নামে একটা new file তৈরি করা হলো lander folder এর মধ্যে
- functions.php এর মধ্যে comment করা হলো
- /**
- * The functions file for the lander childe theme
- */
- front পেজের জন আলাদা style.css তৈরি করা হল, যা শুধু কন্ডিশনালি শো করবে
- <?php
- function lander_scripts() {
- if( is_front_page() ) {
- wp_enqueue_scripts('lander-styles', get_stylesheet-directory_uri().'/lander-style.css');
- }
- }
- add_action('wp_enqueue_scripts', 'lander_scripts');
- ?>
- এটা চেক করার জন্য inspect element> resources> frames> localhost> stylesheets> lander-style.css
- .indent{max-width:1000px;margin:0 auto}
- front-page.php এর মধ্যে book-an-appoinment পেজ শো করাতে চাই
- এজন্য front-page.php এর মধ্যে একটা কোয়ারি করতে হবে***
- যদি এই book-an-appointment পেজ exist করে তবে এই কোয়ারি গ্রহনযোগ্য হবে, যদি exist না করে তবে হবে না
- এই কোয়ারি দিয়ে অন্য পেজের ডাটা ফ্রন্ট পেজে নিয়ে আসা যায়।
- <?php
- $query = new WP_query( 'pagename=book-an-appointment' );
- // The Loop
- if($query->have_posts()) {
- while($query->have_posts()) {
- $query->the_post();
- echo '<div class="entry-content">';
- the_content();
- echo '<div>';
- }
- }
- wp_reset_postdata();
- //without reset query use, the page will continue running this query as the main query
- ?>
- services page এর আলাদা আলাদা services section গুলি শো করাতে হবে।
- অর্থাৎ services এর under এ থাকা different post শো করবে services page এ
- নতুন একটা ভেরিয়েবেল তৈরি করতে হবে services_id যা দিয়ে queried_object এর id পাওয়া যাবে
- <?php
- $query = new WP_query( 'pagename=book-an-appointment' );
- $services_id = $query->queried_object->ID;
- // The Loop
- if($query->have_posts()) {
- while($query->have_posts()) {
- $query->the_post();
- echo '<div class="entry-content">';
- the_content();
- echo '<div>';
- }
- }
- wp_reset_postdata();
- // আরেকটা কোয়ারি তৈরি করতে হবে আলাদা আলাদা services section শো করার জন্য
- $args = array('post_type' => 'page', 'post_parent' => $services_id);
- $services_query = new WP_query( $args );
- //The Loop
- if($services_query->have_posts()) {
- echo '<ul class="services_list">';
- while($services_query->have_posts()) {
- $services_query->the_posts();
- echo '<li class="clear">';
- echo '<a href="'.get_permalink().'" title="Learn more about '.get_the_title().'">';
- echo '<h3 class="service-title">'.get_the_title().' </h3>';
- echo '</a>';
- echo '<div class="services-lede">';
- the_content();
- echo '</div>';
- echo '</li>';
- }
- echo '<ul>';
- }
- wp_reset_postdata();
- ?>
- /*Testimonial*/
- /*Testimonial query*/
- <?php
- $args = array('posts_per_page' => 3, 'orderby' => 'rand', 'category_name' => 'testimonials');
- $query = new WP_query( $args );
- if($query->have_posts()) {
- echo '<ul class="testimonials">';
- while($query->have_posts()) {
- $query->the_post();
- echo '<li class="clear">';
- echo '<figure class="testimonial-thumb">';
- the_post_thumbnail('testimonial-thumb');
- echo '<h3 class="testimonial-name">'.get_the_title().'</h3>';
- the_content();
- echo '</figure>';
- echo '</li>';
- }
- echo '<ul>';
- }
- wp_reset_postdata();
- ?>
- /*
- default post থেকে testimonial post, and post category is testimonial
- front page is home page, post page is news page
- news পেজে গেলে testimonial post গুলি শো করে
- index.php বা ব্লগ থেকে testimonial category exclude করতে হবে
- */
- /*
- more tag use
- */
- /*
- Adding a custom menu to the front page
- if we are in front page we will see custom menu
- and if we are any other page we will see default menu
- */
- <?php
- if( is_front_page() ) {
- /*custom menu*/
- wp_nav_menu(array('menu' => 'Front Page Menu'));
- } else {
- /*default menu*/
- wp_nav_menu(array('theme_location' => 'primary'));
- }
- ?>
- /*
- Creating menu items for page scrolling
- */
- Adding Smooth Scroll for the scrolling effect
- Blogging for Your Business (Morten Rand-Hendriksen, 2013)
- Create an Online Portfolio with WordPress (Morten Rand-Hendriksen, 2011)
- Creating a Marquee in WordPress with jQuery (Chris Converse, 2014)
- Creating a Photo Gallery in WordPress with jQuery (Chris Converse, 2014)
- Dreamweaver and WordPress. Building Mobile Sites (Joseph Lowery, 2012)
- Dreamweaver and WordPress. Building Sites (Joseph Lowery, 2012)
- Dreamweaver and WordPress. Building Themes (Joseph Lowery, 2012)
- Dreamweaver and WordPress. Core Concepts (Joseph Lowery, 2012)
- Dreamweaver CC and WordPress 3.8. Core Concepts (Joseph Lowery, 2014)
- Dreamweaver CS6 and WordPress 3.8. Core Concepts (Joseph Lowery, 2014)
- Installing and Running WordPress. BitNami (Morten Rand-Hendriksen, 2013)
- Installing and Running WordPress. DesktopServer (Morten Rand-Hendriksen, 2014)
- Installing and Running WordPress. MAMP (Morten Rand-Hendriksen, 2013)
- Installing and Running WordPress. Shared Hosting (Morten Rand-Hendriksen, 2013)
- Installing and Running WordPress. WAMP (Morten Rand-Hendriksen, 2013)
- Installing and Running WordPress. WebMatrix (Morten Rand-Hendriksen, 2013)
- Start with a Theme. Creative Portfolios in WordPress (Morten Rand-Hendriksen, 2012)
- Start with a Theme. Food Blogs in WordPress (Morten Rand-Hendriksen, 2013)
- Start with a Theme. Magazine Styles in WordPress (Morten Rand-Hendriksen, 2012)
- WordPress. Building Responsive Themes (Morten Rand-Hendriksen, 2012)
- WordPress.com. Essential Training (Morten Rand-Hendriksen, 2013)
- WordPress. Creating Custom Widgets and Plugins with PHP (Drew Falkman, 2010)
- WordPress. Custom Post Types and Taxonomies (Morten Rand-Hendriksen, 2014)
- WordPress. Essential Training (Morten Rand-Hendriksen, 2014)
- WordPress. Mobile Solutions (Rand-Hendriksen, 2012)
- WordPress 3.8. New Features (Morten Rand-Hendriksen, 2013)
- WordPress 3. Building Child Themes (Morten Rand-Hendriksen, 2012)
- WordPress 3. Creating and Editing Custom Themes (Chris Coyier, 2010)
- WordPress 3. Developing Secure Sites (Jeff Starr, 2011)
- WordPress Developer Tips. Deleting Spam Comments in the Database (Morten Rand-Hendriksen, 2014)
- WordPress Ecommerce. Core Concepts (Morten Rand-Hendriksen, 2013)
- WordPress Ecommerce. Easy Digital Downloads (Morten Rand-Hendriksen, 2013)
- WordPress Ecommerce. Integrating Shopify (Morten Rand-Hendriksen, 2014)
- WordPress Ecommerce. WooCommerce (Morten Rand-Hendriksen, 2013)
- WordPress Plugins. Analytics (Morten Rand-Hendriksen, 2014)
- WordPress Plugins. Backing Up Your Site (Morten Rand-Hendriksen, 2014)
- WordPress Plugins. Contact Forms (Morten Rand-Hendriksen, 2014)
- WordPress Plugins. SEO (Morten Rand-Hendriksen, 2013)
- WordPress Quick Tips. Migration and Database Reset (Morten Rand-Hendriksen, 2013)
- <?php
- $args = array('post_type' => 'page', 'order' => 'ASC');
- $the_query = new WP_Query($args);
- ?>
- <?php if(have_posts()) : while($the_query->have_posts()) : $the_query->the_post(); ?>
- <?php get_template_part( 'content', 'page'); ?>
- <?php endwhile; endif; ?>
- ===================
- <?php
- $query = new WP_query( 'pagename=book-an-appointment' );
- $services_id = $query->queried_object->ID;
- // The Loop
- if($query->have_posts()) {
- while($query->have_posts()) {
- $query->the_post();
- echo '<div class="entry-content">';
- the_content();
- echo '<div>';
- }
- }
- wp_reset_postdata();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment