Add Post Tags to Body Class
That is because the get_the_tags() function returns an array with the tag id as the key value. You could use array_values( get_the_tags( $post->ID ) ). That should do the trick.
That is because the get_the_tags() function returns an array with the tag id as the key value. You could use array_values( get_the_tags( $post->ID ) ). That should do the trick.
Not sure if it is the most elegant way but the easiest is probably to create a shortcode that displays a single page, and then set that page to display as the front page. e.g. http://wordpress.org/extend/plugins/post-content-shortcodes/
Try this: <a href=”https://wordpress.stackexchange.com/questions/39742/<?php echo get_permalink($post->post_parent); ?>”>Attachment parent</a>
I’ve found this piece of code and it works: <?php get_header(); ?> <div id=”job-listings”> <?php $category = get_the_category(); $theName = $category[0]->name; $theChild = $category[0]->cat_ID; $subcats = get_categories(‘child_of=” . $theChild); foreach($subcats as $subcat) { echo “<h3>’ . $subcat->cat_name . ‘</h3>’; echo ‘<ul>’; $subcat_posts = get_posts(‘cat=” . $subcat->cat_ID); foreach($subcat_posts as $subcat_post) { $postID = $subcat_post->ID; echo “<li>’; … Read more
You could always do something like this: echo do_shortcode( ‘[contact-form-7 id=”23″ title=”Contact form 1″]’ ); And put that anywhere in your theme to display it. Docs: do_shortcode
check the built in counter $wp_query->current_post within the loop: <?php while( have_posts() ) : the_post(); if( 0 == $wp_query->current_post ): // this is the first post in the loop, output larger size, full content, etc. else: // output regular size, the_excerpt, etc. endif; endwhile; ?>
Yes, using WordPress shortcodes you can create a quick annotation shortcode. add_shortcode( ‘annotation’, ‘wpse47489_private_annotation’ ); function wpse47489_private_annotation( $args, $content=”” ) { if ( !current_user_can( ‘administrator’ ) ) return ”; return “<div class=”hidden-annotation”>$content</div>”; } This will return an empty string for anyone but administrators. You can always return an empty string ” though, these annotations will … Read more
You could do something like (in your functions.php file); if(current_user_can(‘member’)){ add_filter(‘get_sample_permalink_html’, ‘perm’, ”,4); function perm($return, $id, $new_title, $new_slug){ $post = get_post( $id ); if( ! $post || ( $post->post_type !== ‘testimonials’ ) ) { return $return; } return preg_replace( ‘/<span id=”edit-slug-buttons”>.*<\/span>|<span id=\’view-post-btn\’>.*<\/span>/i’, ”, $return ); } To give credit where credit is due, everything between … Read more
I face this issue quite often on my own site where I publish code tutorials. Unfortunately, there isn’t a good solution. Instead, I recommend this workflow: Use the WYSIWYG editor to build your article content leaving placeholders for your code snippets. Switch to the HTML editor to add your code snippets The visual editor (TinyMCE) … Read more
Try this: if ($my_query->post_count < $min_posts) { // Do Something. } Good luck! Hope that helps.