How to create first post, fifth post full width, rest in three columns and so on

<?php get_header() ?> <div class=”container-fluid”> <div class=”row”> <?php $i = 0; while ( have_posts() ) : the_post(); ?> <?php if ($i == 0 || $i % 4 == 0) : ?> <div class=”col-sm-12 blog”> <div class=”row”> <div class=”col-sm-8 p-0″> <?php the_post_thumbnail()?> </div> <div class=”col-sm-4 align-self-center”> <div><h3><?php the_title()?></h3></div> <div><?php the_excerpt()?></div> </div> </div> </div> <?php else: ?> … Read more

WordPress template page name displayed on screen

If your template file doesn’t have the <?php tag at the top, you should add it. <?php /* Template Name: Exhibition – Pilgrims */ …is how the very top of your template file should look. Your sample should read like this. <?php /* Template Name: Exhibition – Pilgrims */ get_header(); ?> <div class=”container fadeIn perimeter”> … Read more

Show meta box only for default page template

If the “Default Template” option is selected from the Template dropdown, then WordPress will set the value of the _wp_page_template meta to default and not page.php, so that’s most likely the reason why your meta box is not showing/added. So I would use if ( in_array( $pageTemplate, array( ‘default’, ‘page.php’ ) ) ) instead of … Read more

What is wrong with my page.php?

if i understand right the problem is that you assign a static $page_id = 98; so no matter what page you go to it will only display that page’s content. what you need is to use the WordPress loop so change your code to this <!– Start Page Content –> <h1 class=”blog-title”><?php the_title(); ?></h1> <?php … Read more

Displaying page image in the footer automatically

You want to use the Featured Post Thumbnail: http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/ http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/ http://codex.wordpress.org/Function_Reference/the_post_thumbnail In your functions.php, define an image size with add_image_size(), then display it in the footer like this: the_post_thumbnail(‘footer-image’); Keep all of the loop inside of your main template file and do not split it across multiple files. That’s really messy, and as you’ve figured … Read more

Is it possible to add a child post into the parent page?

First, you need to query the child Pages: $pageargs = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID ); $childpages = get_posts( $pageargs ); Then, you need to create your custom Loop: foreach ( $childpages as $childpage ) { // Output whatever you want here, such as: … Read more

How to get nav_menu_item_id and slug from wp database

Hi @Anjum: I think the function get_nav_menu_id_by_page_template()is what you are looking for? You can place the code for this function in your theme’s functions.php file, or in a .php for a plugin you are writing: function get_nav_menu_id_by_page_template($template) { static $nav_menu_id; if (!isset($nav_menu_id)) { global $wpdb; $sql = <<<SQL SELECT menu.post_id AS menu_id FROM {$wpdb->postmeta} AS … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)