is_category
checks whether or not the current page is the Archive Page for the specified category, not if the current post is in the category. You want in_category
.
/* Code to Display Featured Image on top of the post */
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
if ( in_category( 31 ) ) {
the_post_thumbnail( 'post-image' );
}
}
Related Posts:
- WordPress function like is_category for subcategory? is_subcategory?
- deregister scripts on certain page
- is_front_page not working in functions.php
- disable comments if array exists
- Problem using is_single() to enqueue script from functions.php
- Conditional tag is_page with a custom post type
- Limit posts only on home page – ideally in functions.php
- Enqueue scripts not working with if is page conditional tag in functions.php
- Conditional read more adjustment
- How add various functions within 1 conditional?
- Conditional Gravity Forms filter in WordPress Multisite
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- is_page() or is_single not working
- functions.php and conditional tags
- issue with if/elseif in_array inside foreach loop display only one post
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- Entirely Different Functions.php per Page?
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- If is_single in functions.php
- Enqueue script if not page template
- is_product_category(‘Services’) not working
- method to fetch entire tag list on archive.php
- Adding an IF ELSE to a function
- Load CSS conditional on custom field is present
- admin-ajax.php nulls all php variables
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- wp_enqueue_scripts called twice?
- How can i hide content if not friend in Buddypress? [closed]
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- Logout/login redirect CSS issue
- change the comment time output to: X time ago instead of actual date and time
- Generate
- Gallery images titles – get from post
- Shortcode to insert menu in page body?
- Too few arguments sent to custom function
- woocommerce target button with class after ajax update
- WordPress doesn’t Load JQuery Now? Do I need to enqueue JQuery also?
- How to select a page within admin?
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- Adding multiple taxonomy filters to functions.php
- Add function to Simple Twitter Connect to not Tweet pages
- Enqueue Style Only On Certain Pages Not Working
- Loading CDN that requires jQuery in WordPress
- Translation of theme using child theme
- Last Login in number of days format
- Display post shortcode content in the sidebar?
- IF Statement on Button to make it complete and “uncomplete” based on user action / click
- Gravity Forms Button Text
- How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?
- change the url paths in the stylesheet dynamically
- When sale price is 0.00 show only regular price
- Dumping variable in custom pre_gets_post function in functions.php, returns NULL
- How to load parent theme template parts in child theme
- Cannot modify header information – headers already sent (wp_redirect in functions.php)
- Javascript function not working when placed in Text Block
- Need help getting a function to function
- Load Post into DIV with Ajax
- Cannot declare function twice [closed]
- Running script based on Category
- Get array of metakey in all posts
- How do I hook into the container of wp_nav_menu?
- Remove links from the_content when using filters wp_trim_excerpt
- Function not working inside of a function in functions.php
- How to Use Global Variables Inside Header and Footer
- Redirect website domain (including all pages) to external URL after Popup message (few seconds)
- Where do I go to edit this area? [closed]
- Enable right click on WordPress site
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- Email Exists ERROR into Ajax registration form
- How to overwrite template.php file
- Limit number of characters in different excerpts
- How to avoid saving empty data to sql while using add_meta_box
- How to assign php file(template) to several pages with same prefix page name/slug
- How to fix Function create_function() is deprecated in / themes
- Block all plug-ins from initiating redirection upon activation?
- How to display my comment count in the wordpress admin bar?
- custom error message for empty username and password using authenticate filter not working
- Modifying a WordPress Plugin
- Last updated posts shortcode in functions.php
- I have an fatal error on my funcyions.php
- Get post_author email for Zapier Integration
- get_locale() is different from $locale
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Remove the delete link from pages without a plugin
- Custom download page
- HowTo: Add wrapper to columns shortcode?
- How to include a hyperlink in the body text of a custom password protected form?
- Get title from IDs in a string
- uninstall a theme programmaticlly
- Could you please correct the code is_admin()
- Adding a filter with custom function to the menu / navigation
- Increase Comment Author Gravatar Size On WordPress Default Comment Function
- Random text changing to weird icons in both admin & front end
- theme options not saving
- How about many “require_once” will affect the page load speed? [closed]
- Owl Carousel and WordPress Integration Via WP_Enqueue
- iOS and ajaxComplete