Efficient way of querying for a “fallback” post?
Efficient way of querying for a “fallback” post?
Efficient way of querying for a “fallback” 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
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
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
how to remove replicating a tag inside loop?
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
As Milo mentioned, this is an Advanced Custom Fields plugin (ACF) question. As such I have raised this ticket with the ACF support team here https://support.advancedcustomfields.com/forums/topic/how-to-replace-hard-coded-list-of-custom-taxonomy-terms-based-on-custom-field-qu/
This isn’t really a WordPress specific question but here’s what you’ll likely want to do. Notice also the example below is using the PHP date function which will dynamically update the year: style.css .copyright { color: #ffffff; display: table; margin: 0 auto; } .copyright a { color: #0080ff; } footer.php <div class=”copyright”> Copyright © <?php … Read more
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
Woocommerce uses the post_type product for products, so it should be easy enough to search for those instead of posts. Just look out for the proper post_type. You could filter the revisions using a self-joined select like this: SELECT * FROM `wp_posts` p1 LEFT JOIN `wp_posts` p2 ON (p2.post_parent = p1.ID and p1.post_type=”products”) WHERE p1.`post_type` … Read more