If you mean a single post, not a page then use the conditional tag is_single()
and check for this, like:
function demo_link() {
if ( is_single() && in_category( 'themes' ) ) {
// Some code #1
} else {
// Some code #2
}
}
add_action( 'thesis_hook_after_post_box', 'demo_link' );
If you will use it on page, static post type from WP, then use is_page()
or use is_singular()
for post and page. The current example check for post and if in category ‘themes’, the output ‘Some code #1’ or if not this conditional statement, the output ‘Some code #2’.
Related Posts:
- Display Footer Shortcode Different for Logged In Users
- Why might conditionals not work on a page?
- Getting false for is_home() on Posts page
- Help with if else statement for separating content from image attachment
- How do test if a post is a custom post type?
- What is the condition to check if we are in admin or frontend?
- Actions, functions and conditionals
- if (is_page(**PAGE ID**)) not working
- is_home , is_front_page not working
- What is the correct method for determining ‘is_front_page’ when using filters such as ‘pre_get_posts’ and ‘posts_where’?
- how to check if front page is set to show a static page
- Way to check if we are in Theme Customizer mode? [duplicate]
- How can we use conditional tags in plugins?
- Conditional tag for all categories of a custom post type
- Possible to use conditionals within add_feed() callback?
- Exclude custom function content from certain pages
- is_home() vs is_archive()
- Blog Posts vs Static Page (conditional statements)
- Adding Controls to Theme Customizer If Certain Page Template is Active
- Problem with “conditional tag”: if empty
- Do I need to include ‘else’ and/or ‘endif’?
- Trying to use Ternary operators with WP Conditionals
- is_singular() equivalent for backend
- Make specific tag visible only to logged in users in front-end
- How can i know when i can execute what functions of wordpress?
- How can I achieve something like has_post_format( ‘standard’ )?
- Issue getting gettext to work with conditional statements
- Post tags show outside loop?
- Need help with else if statement
- WordPress conditionals not working
- wp_head hook by page ID [closed]
- Cannot Use is_single() and is_admin in functions.php
- Hide a template part when page is password protected?
- Limit Contact Form 7 hook to specific form [closed]
- conditional statement for custom taxonomy
- Checking whether template part is loaded in a page
- Conditional tags inside a class
- functions.php conditional tag – only show in single.php?
- BuddyPress User Profile Menu
- Use slug rather than id for $post->post_parent?
- If (category / tag checked) then (display header2php)
- If Parent or Current Page Is, Then Statement?
- Identify a Woocommerce page by WordPress conditional tags
- is_page conditional question
- Trouble with parent and child conditional tag to show content
- A simple method for disabling WPML language switcher when meeting specific circumstances [closed]
- Display a div only in some author’s single posts
- Conditional Tags Based on Previously Viewed Posts
- How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
- What do I add to this code to include additional CPTs?
- Loading template parts conditionally in Customizer
- Conditional check for embedded video in the_content
- Conditional IF statement not returning true even though echo of $user->province is correct
- is_front_page not working at all in any of the themes .php files
- is singular and is home not working
- add styles if custom header was included
- Check if user registered more than a month ago
- PHP if statement printing the if parameters
- Conditional for a Single Post That Belongs to a Category?
- Why is this is_page conditional not working?
- If page displays posts conditional
- Conditional tags not working
- How to check with is_page if 404.php is loaded?
- Sub-category single post styling?
- I need use is_single in functions.php
- How to apply a function if conditon a & b [closed]
- do code if current url = value
- Conditional display faults
- Add class to DIV depending on page loaded
- Conditionals: What is wrong with my if/else statements? [closed]
- Is there any way to assign stylesheets to whole sets of pages using is_page( )
- is_home() returns true while it shouldn’t
- Conditional tags help (if none, don’t display anything)
- How to display a feature only if custom field value is set?
- Filter for the Custom Post List Page
- Additional conditions tags to work
- Gravity Forms, multiple conditions in shortcode
- Can this code be concatenated?
- Conditonal tag or work around to identify page number of pagnation
- Multidimensional Array
- Conditional: current user updated post in the last X days
- How can I get $pagenow equals to the Home Page or specific page on my site?
- page single conditional
- Three variables on conditional tags
- Is it possible to If statement “article already appears on page”?
- How to use the conditional homepage tag
- Which is the right order of the conditional tags on pages?
- Hide breadcrumbs on specific pages
- Pre Get Posts – Difference between conditional() and $query->conditional()?
- If less than IE9 [closed]
- Cannot retrieve active members only
- Else statement not triggering after a failed if statement
- If custom taxonomy else conditional [closed]
- How to get type of archive whether it is post or date or category archive?
- Custom Function for Portfolio Archive Template With Conditonal Tag
- Conditional Custom Image Header
- Trying to place shortcode/css/html into an IF conditional statement
- Conditional Tag Based on Age of Post [duplicate]
- Will multiple conditionals slow down page load?
- conditional statement for profile pages