This will help get and display the 1st category ID of the current post $categories = get_the_category(); //get all categories for this post echo ‘first category is ‘ . $categories[0]->cat_ID;
You can use this code in your functions.php file to change the excerpt length and also the ‘more’ tag. // Replaces the excerpt “more” text by a link function new_excerpt_more($more) { global $post; if (is_category( ’21’ )){ return ‘ View Image Gallery‘; } else { return ‘ Read the full article…‘; } } add_filter(‘excerpt_more’, ‘new_excerpt_more’); Read More…
This is the code I got to work after realizing that the code I was using broke the pagination. <?php if ( is_home() ) { $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; query_posts(‘cat=-21&paged=’.$paged); } ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> The code below worked part way, but Read More…
This is an ongoing list of plugins I have used that I find super useful. I hope to write a review of each one in the future. Advanced Custom Fields Gravity Forms Gravity Forms PDF extended Gravity Forms – Placeholders add-on Orangebox Twitter Tools Random Text The Events Calendar Simple 301 Redirects Social Gallery Plugin Read More…
Add this code outside the loop on the template page to enable password protection. <!–password protect code –> <?php if ( ! post_password_required( $post ) ) { ?> <!–password protect code –> CONTENT LOOP <!– end of the password protect –> <?php } else { echo get_the_password_form(); } ?> <!– end of the password protect Read More…
Add placeholder text for gravity forms with Gravity Forms – Placeholders add-on plugin. Then add the class gplaceholder to the form. You can also use this code <script type=”text/javascript”> jQuery(document).ready(function($) { jQuery.fn.cleardefault = function() { return this.focus(function() { if( this.value == this.defaultValue ) { this.value = “”; } }).blur(function() { if( !this.value.length ) { this.value = Read More…