Tag Info

Hot answers tagged

3

You can use $wp_query->current_post in your loop to check the current post. You don't need two loops, one will do the trick If you need excerpt for first post only, you can do something like this. Just remember, the first post in the loop is 0, and not 1 if ( !$wp_query->current_post > 0 ) : the_excerpt(); else : <--- DO SOMETHING ELSE FOR ...


2

You can set it with a counter. Using the default loop as a sample: <?php $firstExcerpt = 0; // Set the variable to 0 so we can check for it later. if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> <?php if ($firstExcerpt < 1) { // Check if it's been displayed ...


2

If this is only for certain content areas, create your own filter, and base it off the original the_content filter. Put this in your functions.php (found in wp-includes/default-filters.php) add_filter( 'se152488_the_content', 'wptexturize' ); add_filter( 'se152488_the_content', 'convert_smilies' ); add_filter( 'se152488_the_content', ...


1

This is a required field (http://codex.wordpress.org/Function_Reference/wp_create_user) and I think that more than one function in the core of Wordpress relies on that. So I would not recommend to code around it or alter any other WP core files as the next update could render all these changes back to the default values.


1

The way you do it is fine. Also have a look at how Tom McFarlins WordPress Plugin Boilerplate does it: if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { require_once( plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin.php' ); add_action( 'plugins_loaded', array( 'Plugin_Name_Admin', 'get_instance' ) ); ...


1

You have the orderby parameter in your query but you are missing the companion order. This gives ascending/descending rule to the sortation. WordPress Codex reference


1

I'm having trouble understanding the question, but I'm assuming the code snippet you posted containing query_posts is in a category, archive or index template which is called when you follow on of the links generated by get_category_link (). If so, the query_posts function is overriding the default loop, but you're not including the category to filter by so ...


1

These additional dropdowns are added via the restrict_manage_posts action hook. This means the dropdown output isn't filterable, but you can remove the hooked action from Yoast SEO. The filter dropdown is added by the posts_filter_dropdown() method in the WPSEO_Metabox class. It's added in the setup_page_analysis() method of the same class, which is hooked ...


1

EDIT: Answer has been found and I am posting it for anyone else who has this issue. If you have better ways of accomplishing this then please post below for the benefit of others. Place this code in your category.php. It will automatically grab the category from the URL and pass it to the cat => $category_id and update the loop accordingly. <ul ...


1

The antispambot() method is still very reliable and robust from my experience, I have not had many problems using it but something else to look at depending on how far you are willing to go in securing your email address is to look into probably one of the easiest and most effective methods but also least known, believe it or not just requires minor CSS. I ...


1

What about something simple like: $i = 1; if( have_posts() ) { while( have_posts() ) { the_post(); if( 1 == $i ) { the_excerpt(); } // the rest of your loop $i++; } }



Only top voted, non community-wiki answers of a minimum length are eligible