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 OTHER POSTS
endif;
For all the WP_Post
member variables, go and check the link provided from the codex
Related Posts:
- Issues with title-tag and document_title_parts
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Allow tags and attributes in post and pages content
- ACF not showing
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Add Element as a Filter to the_content
- Override the WordPress core function wp_referer_field
- Modify post filter to set custom number of posts per page and exclude child posts
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- Replace single_template filter with what for default posts?
- How can I add a filter for specific categories on functions.php?
- How to add custom JavaScript in functions?
- Setting a default text for excerpts of a particular category
- How to edit the Tags within the image file URLs?
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- Can’t properly set the_title add_filter to show short_URL
- Add_filter when value is no variable?
- Control the srcset much more (not all sizes in it each time)
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- How to add_filter html template to middle of content
- Remove Custuomize Sections
- (Woocommerce) Order by price when entering specific category
- Filter an WordPress Function in (general-template.php)
- Can we create our own theme’s function.php?
- Define PHP variable from a seperate API if statement
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- Redefine function arguments before rendering
- Some questions about how proper add 2 CSS file in a WordPress theme?
- How to edit classes in body tag?
- Filter nav menu items HTML tags and wrap inner text with span
- Possible to hook into Media Library preview File column and use a custom image?
- How can I add a class to a nav li depending on URL?
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links
- Modify gform_other_choice_value for specific form and specific field in Gravity Forms
- PHP 7.1 | Warning: A non-numeric value encountered in
- Combine embed_oembed_html and oembed_result
- login_headertitle is deprecated since version 5.2.0
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- Filter to wp_list_authors
- How to add custom li item to wordpress menu
- Native gallery custom html output
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- The_content and Preg_replace in loaded Iframe [closed]
- Getting the teaser text without overriding global variables
- Combine two active_callbacks into one on theme customizer
- WP Customizer API loaded into functions.php
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- Functions Filter Question [closed]
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- “options.php” not found
- Add Adsense code between job listings – wp job manager plugin
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- How to add aria role and schema markup to custom walker container
- Problem with images URL after filter applying
- remove_action not working, even after changing priority [duplicate]
- Is this an acceptable practice for WordPress theme development?
- remove/hide wp-editor
- What is the correct way to include my new functions and scripts in WordPress?
- wp_nav_menu work in functions.php but not in the theme
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- Replace header image on all other pages but home – URL issue
- Add a class to post if it has been recently updated
- contact form in template with jquery,validate and ajax
- search form leads to 404
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- How to set default values for edit_post_link() in my theme?
- how to add_filter to non hook function
- Changing the text of Upload/Insert on Posts and Pages Screen
- Any adverse effects of adding apply_filters to a function?
- Conditional custom menu?
- Get URLs for AJAX Filter Checkboxes WordPress
- Woocommerce Variable Product Dropdown for Custom Shop Template
- how can I add filter in specfic field in my website?
- How to display an image before title text in menu items
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- Adding custom social icons to the social media icon block in the Gutenberg editor?
- WordPress wp_dequeue_script remove all other scripts
- Customizing the wp_video_shortcode output with add_filter
- Filter works on last selection but no others
- Overwrite text in a complicated filter hook
- Unpublished Pages Failing To Appear On Custom Path
- Override category archive page title (not the head title)
- How to add HTML into error message
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- Save_post – Warning: Cannot modify header information
- custom error message for empty username and password using authenticate filter not working