Aniruddha Gawade
  • Member for 5 years, 4 months
  • Last seen more than a week ago
  • Korgao, Corgao, Pernem, Goa, India
Post tags show outside loop?
6 votes

Use get_the_tag_list() instead of the_tags(), since the_tags() prints the results while get_the_tag_list() returns it. See documentation: https://developer.wordpress.org/reference/functions/...

View answer
Include a php file from functions.php only to homepage
Accepted answer
3 votes

You can use is_home() or is_front_page() to check the current page. $sage_includes = [ 'lib/assets.php', // Scripts and stylesheets 'lib/theme_options.php', // Theme Options 'lib/...

View answer
How can I implement a notification system in wordpress?
3 votes

If you look through the definition of wp_insert_post(), you'll see do_action( 'wp_insert_post', $post_ID, $post, $update ); at the end of it. So you can hook into this and perform whatever task you ...

View answer
Using WP_Query and WP_Meta_Query Outside of Wordpress
3 votes

This is what worked for me: require_once 'wp-config.php'; global $wpdb; $args = array( 'post_type' => 'product', 'posts_per_page' => -1, ); $Query= new WP_Query($...

View answer
Woocommerce 2.5.5 get billing email from order instance
Accepted answer
2 votes

In WC version 2.5, get and set functions are not available. The parameters you want are public. So, you can directly access them: $customer_email = $order->billing_email; $shipping_country ...

View answer
Function works everywhere, how to keep it to execute when creating a new post
Accepted answer
2 votes

save_post accepts one more parameter $update. $update : Whether this is an existing post being updated or not. So in your code add_action( 'save_post', 'analyze_mp3', 10, 3 ); function analyze_mp3(...

View answer
How to hide few theme customization options - TwentySeventeen theme
Accepted answer
2 votes

You can change active status of section using customize_section_active filter. It gives 2 parameters $active-bool and $section-object. Haven't tried it so you can try and see if works for you. ...

View answer
Echo values from custom field outside loop php
2 votes

You need to pass $postid to your get_field function. <?php $value = get_field( "employee_category", $postid ); if( $value ) { echo $value; } else { echo 'empty'; } ?...

View answer
use get_theme_mod from all sites in network
Accepted answer
2 votes

You will have to switch to your blog using switch_to_blog( $blog->blog_id ); and the access the data you want from that blog. switch_to_blog( $blog->blog_id ); get_theme_mod('your_key'); This ...

View answer
How to include jQuery when no header and footer on the page
2 votes

Use wp_head(); and wp_footer(); if you're putting all html in just one file. Although I would suggest making custom header for your plugin page. Which will have <head>, <html> and other ...

View answer
body class according to number of published custom posts
2 votes

You can use count_user_posts See: https://developer.wordpress.org/reference/functions/count_user_posts/ Edit: <?php if (is_user_logged_in()) { $count_class = 'CUSTOMPOST-'....

View answer
Get specific posts by ID in wordpress
Accepted answer
2 votes

Try this: <?php $thePostIdArray = array("11", "13", "15", "17", "19"); $limit = 5; $query=new WP_Query(array('post__in'=>$thePostIdArray)); if ( $query->...

View answer
Display custom post type by custom taxonomy
2 votes

The problem is in your tax_query terms parameter. Try: 'tax_query' => array( array( 'taxonomy' => 'listings_tags', 'field' => 'slug', 'terms' =&...

View answer
Can I install a new Wordpress site inside a sub-directory of an existing Wordpress site?
Accepted answer
2 votes

Yes, you can do that. It won't affect any of the installation. I have already done this for few sites. Works without issue.

View answer
wp_enqueue_scripts does not work
Accepted answer
2 votes

If do_action works, then the problem should be you are not calling wp_head() and wp_footer() in your header.php and footer.php respectively.

View answer
How to get a list of bundled products using wp_query in woocommerce
Accepted answer
2 votes

You should be able to do it using 'tax_query': 'tax_query'=> array( array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => 'bundle', ), )...

View answer
Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop
Accepted answer
1 votes

This can be done using WP_Query using author and tax_query. Something like this: $args = array( 'post_type' => 'post', 'author' => get_current_user_id(), 'tax_query' => array( ...

View answer
get_theme_mod only returns false
1 votes

Problem 1: get_option instead of get_theme_mod. How you store and retrieve value depends on the type you pass to your add_setting function. See https://codex.wordpress.org/Class_Reference/...

View answer
WP_Query->request has a limit
1 votes

Use the posts_per_page parameter in your WP_Query to show a given number of posts. When you don't provide this parameter, the query takes default value which can be set in backend on https://example....

View answer
fetch woocommerce product with custom taxonomy
1 votes

Your template name should be: taxonomy-item.php. It should be taxonomy slug, without product-cat.

View answer
I am unable to login into my wp-admin
1 votes

You can fix this by changes site_url and home_url in your database. If you have access to your database(phpmyadmin) go to options table and change site_url and home_url from HTTPS to HTTP. You can ...

View answer
Writing Clean WooCommerce Styles
1 votes

It is always a good practice to use maximum number of classes, because using more classes gives more weight-age and it will always consider your css first. But try not to use div or p tag while ...

View answer
Authors details such as social media links, emails etc → Is this Meta or something else?
1 votes

Yes, those fields will be user meta. And for storing social links of a user you'll have to add custom user meta. Here's developer's documentation for your reference: https://developer.wordpress.org/...

View answer
can we modify wordpress plugin version value to avoid update warning?
1 votes

You can use site_transient_update_plugins hook to disable plugin updates. function filter_plugin_updates( $value ) { unset( $value->response['plugin_folder/plugin_name.php'] ); return $...

View answer
How to Display child post on his parent post with thumbnail and content in WordPress
Accepted answer
1 votes

Just to check I understood your question, you want to display child posts under each parent post? In that case you have to write one more WP_Query inside your while loop, with parent as current post ...

View answer
How to add some php code in header.php using plugin
Accepted answer
1 votes

Looks like just syntax: add_action( 'wp_head', function(){ ob_start(); }

View answer
Is There A Way To Make Theme Files Accept Shortcodes?
1 votes

Try do_shortcode() <?php echo do_shortcode('[your_shortcode]');?>

View answer
Get post according to current taxonomy
Accepted answer
1 votes

Try this for WP_Query $args = array( 'post_type' => 'example', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'identite', 'field' => 'ID', ...

View answer
Query for posts from any post type but only add instock products
Accepted answer
1 votes

You can check status instock only if meta key _stock_status exists. Something like: 'meta_query' => array( array( 'key' => '_stock_status', 'value' =...

View answer
How to get current category
Accepted answer
1 votes

You can use get_queried_object(), which will return category object. See documentation: https://codex.wordpress.org/Function_Reference/get_queried_object

View answer