Conditional statement to show pagination

You could do this like so: <?php $next_post_link = get_next_post_link( ‘%link’, ‘Article Précédent’, TRUE ); $previous_post_link = get_previous_post_link( ‘%link’, ‘Article Suivant’, TRUE ); ?> <?php if ( $next_post_link || $previous_post_link ) : ?> <div class=”article_single_prev_next”> <div class=”article_prev”> <?php echo $next_post_link; ?> </div> <div class=”article_next”> <?php echo $previous_post_link; ?> </div> </div> <?php endif; ?>

Change content layout based on menu hierarchy

You can use wp_get_nav_menu_items to grab the menu in question, then go through the array of items to output the content function output_landing_page_content(){ //grab the menu items in order $menu_items = wp_get_nav_menu_items( $your_menu_id, array( ‘orderby’ => ‘menu_order’ ) ); foreach ( (array) $menu_items as $key => $menu_item ): //get post id of linked page/post $postid … Read more

get_option() returning empty

I can’t see where the $option_name is declared, and don’t know what it contains. You are using that variable ($option_name) in the name attribute of the checkbox. You need to give to the name attribute of that checkbox field the name of your option. That is the second argument in the register_setting function. So if … Read more

multisite: global menu containing network site links?

[*] get_sites() will get a list of the sites in a Multisite network. You can then use switch_to_blog()[*], get_posts() / get_pages(), and restore_current_blog()[*] to get the pages from the various sites. I’d strongly recommend storing the results as a sitewide option using update_site_option() to lessen the load on your server. You could add a job … Read more

Fatal error in comments.php

As strange as it may sound, but the error was because in one of the posts I had published , there was – at end!! So I deleted the posts as that looked like the problem. Then I restored them one of one and tried to find out what was the problem. Not sure why … Read more