get_terms and meta_value results blank

Here I’ve written a sql based function for you. By this you’ll get the terms ID with slug and name by passing the parameter’s as an array- function the_dramatist_get_terms_with_post_meta( $args = array() ) { global $wpdb; $default_args = array( ‘taxonomy’ => ‘category’, ‘meta_key’ => ”, ‘meta_value’ => ”, ‘post_type’ => ‘post’ ); $param = wp_parse_args( … Read more

How to make a new function that includes a template

Add your share button html to a template file in your theme: your-theme/share-buttons.php <a href=”http://twitter.com/home/?status=<?php the_title(); ?> – <?php the_permalink(); ?>” target=”_blank” title=”Tweet this!”><img src=”http://localhost:8888/wordpress/wp-content/uploads/2016/10/social-twitter.png”></a> <a href=”http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?>” target=”_blank” title=”Share on Facebook.”><img src=”http://localhost:8888/wordpress/wp-content/uploads/2016/10/social-facebook.png”></a> <a href=”http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $url; ?>” target=”_blank”><img src=”http://localhost:8888/wordpress/wp-content/uploads/2016/10/social-pinterest.png”></a> <a href=”http://www.bloglovin.com/e/?b=’ .get_bloginfo(‘wpurl’) . ‘&#038;p=’ .get_permalink().’&#038;t=”.get_the_title().””onclick=\’window.open(this.href,&quot;bloglovin_like&quot;,&quot;height=320,width=480,toolbar=0,location=0,menubar=0,scrollbars=0,status=0&quot;); … Read more

How to load jQuery in TOP of wp_footer?

To properly enqueue jQuery, it’s usually done with wp_enqueue_scripts, there’s no need to load it from cdn as jQuery library are provides in the wp-includes folder of WordPress. Only wp_enqueue_script(‘jquery’); is required. add_action(‘wp_enqueue_scripts’, ‘replace_jquery’); If you really want to replace jQuery with the cdn link, it’s better to register and enqueue it with this function.

Add date before entry title in Twenty Twelve

Base on @Tunji answer. You can add some conditions to the function to detect home-page, feeds… function display_extra_title( $title, $id = null ) { $date = the_date(”, ”, ”, false); if(is_home()){ $title = get_bloginfo( ‘name’ ); return $date . $title; } else{ return $date . $title; } } add_filter( ‘the_title’, ‘display_extra_title’, 10, 2 ); In … Read more

Else/If Statement to Display Photo Descriptions

How about like this: <div style=”position: relative”> <?php the_post_thumbnail(‘large’); $imagedesc = get_post(get_post_thumbnail_id())->post_content; if(!empty($imagedesc)) { echo ‘<span style=”position:absolute; bottom:9px; right:0; color:#FFF; background:rgba(0,0,0,0.8); padding:4px 6px; font-size:0.7em”>’; echo $imagedesc; echo ‘</span>’; } ?> </div>

How to hide the author box of a specific user?

If you know the data of the author, you can wrap that box with an if and the function get_the_author if( get_the_author() == “name_of_the_author” ){ // Don’t do it }else{ // Print box } EDIT with the final answer updated: <?php echo $td_mod_single->get_social_sharing_bottom();?> <?php echo $td_mod_single->get_next_prev_posts();?> <?php $user = get_user_by(“login”, “pknn”); // user object // … Read more

post_content is stripping HTML when adding a new post? [closed]

When WP inserts a post one of the things it does is check both the current user’s capabilities, and which html tags are allowed to be used. There are two ways to modify this: Method 1: wp_kses_allowed_html hook You can modify the allowed set of html tags, given a context, by using this filter: https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html … Read more

“All posts” in the category widget

If the default category widget’s interface doesn’t offer what you want, there are roughly two courses of action: find another widget or adapt the existing one. The first would be outside the scope of this site, the second one is a bit too broad, but here’s what you would do for big adaptations: Build the … Read more