Only display notification on single post

I think the solution is to check if it’s the main query. WordPress has a function for that, is_main_query() The query that you’re running in your related posts widget is a secondary query, so is_main_query() will return false. You can take advantage of that, by changing your code like this: if ( ! is_main_query() || … Read more

How to create a php page to collect information from a html page

Here I’ve added a this hidden input <input type=”hidden” name=”action” value=”your_form_task”> and updated the post URI to <?php echo esc_url( admin_url(‘admin-post.php’) ); ?>. Here is the updated form- <form method=”get” action=”<?php echo esc_url( admin_url(‘admin-post.php’) ); ?>” name=”emailForm” onsubmit=”return validate()”> <div class=”form-group”> <label for=”name”>Name<span id=”req”>*</span></label><br> <input type=”text” class=”form-control” id=”name” name=”name” placeholder=”Quantum Management” value=””> </div> <div class=”form-group”> … Read more

My query keeps looping infinitely ! how to stop it?

Like Tom commented, your code is hard to read. You can look at the code snippet below as a suggestion based on what your code. function get_posts_by_admin_role( ) { if ( is_admin() && !is_front_page() && !is_singular() && !is_archive() ) { $args = array( ‘role’ => ‘administrator’, ‘orderby’ => ‘post_count’, ‘order’ => ‘ASC’, ‘count_total’ => false … Read more

Need Quick Help With Product Category Page

For Woocommerce product categories, use <?php if ( is_product_category() ) { echo ‘<div id=”prodcatdesc”>’; if ( is_product_category( ‘shirts’ ) ) { echo ‘Hi! Take a look at our sweet tshirts below.’; } elseif ( is_product_category( ‘games’ ) ) { echo ‘Hi! Hungry for some gaming?’; } else { echo ‘Hi! Check our our products below.’; … Read more

Widget Update problems using a for loop

Please replace below line: echo “<input class=”widefat” type=”text” value=”{$instSpecLine}” name=”{$instSpecLine}” id='{$instSpecLine}’ placeholder=”Spalte {$j}” >”; With Below code: echo “<input class=”widefat” type=”text” value=”{$instSpecLine}” name=””.$this->get_field_name(“spec_line_{$i}_{$j}”).”” id='{$instSpecLine}’ placeholder=”Spalte {$j}” >”; Hope this will help you