Detecting if I’m on a single, non-post, non-homepage page?
The condition is_home() is right, but the condition have_post() in the template page.php will be true because at least one post of type ‘page‘ exist. A page is already a post.
The condition is_home() is right, but the condition have_post() in the template page.php will be true because at least one post of type ‘page‘ exist. A page is already a post.
add this code into functions.php and a taxonomy box will be created for page from where user can make categories for page. <?php add_action( ‘init’, ‘create_book_tax’ ); function create_book_tax() { register_taxonomy( ‘genre’, ‘page’, array( ‘label’ => __( ‘Genre’ ), ‘rewrite’ => array( ‘slug’ => ‘genre’ ), ‘hierarchical’ => true, ) ); } ?>
Encoding matter – ? instead of € after settings field callback
Replace $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query, ‘orderby’ => ‘price’, ‘order’ => ‘asc’, ); New code $orderby = $_GET[‘orderby’] ?? ”; $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query ); if … Read more
Is it possible to have a global parameter page which allows to configure other plugins in the same place?
How can I remove the navigation menu from a Page that is not on the menu?
you can use get_pages() function, something like this: $mypages = get_pages(); echo ‘<ul>’; foreach($mypages as $page){ echo ‘<li class=”page_item page-item-‘.$page->ID.'”><a href=”‘.get_page_link($page->ID).'”>’.$page->post_title.'</a></li>’; } echo ‘</ul>’;
Sure, if you want it by ID (which might or might not be good idea, depending on how likely ID will stay same for a long time – no migrations, etc) that would be something like: if( !is_page(135) ) { // code goes here } See Conditional Tags > Page in Codex for more. Alternative … Read more
You need to add a Custom Post Type with slug giveaways and create posts under that Post Type. It will give you url like example.com/giveaways/post-name as required.
please try this if ( have_posts() ) : while ( have_posts() ) : the_post(); if ( get_post_status (get_the_id()) == ‘private’ ) { if ( current_user_can( ‘administrator’ ) ) { the_title(); the_content(); } else if ( current_user_can( ‘subscriber’ ) ) { the_title(); the_content(); } else { echo ‘this post is private’; } } else { the_title(); … Read more