run only on posts listed under one category
I highlighted that “posts” because if so, then the conditional tag you should use is in_category()
and not is_category()
which is for category archive pages (e.g. example.com/category/foo
) — so for example, is_category( 93 )
checks if the current archive page is for the category (with the ID of) 93, whereas in_category( 93 )
checks if the current post is in the category 93.
So try with:
<?php if ( is_single() && in_category( 93 ) ) :?>
<script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/hidden.js");</script>
<?php endif; ?>
Related Posts:
- Randomizing wp_tag_cloud() in child theme
- get_template_directory_uri pointing to parent theme not child theme
- How to customize the_archive_title()?
- How to override parent functions in child themes?
- remove_action on after_setup_theme not working from child theme
- Access category within rss2_head hook?
- issue with if/elseif in_array inside foreach loop display only one post
- Can’t locate custom image sizes defined by child theme
- Add back in child theme what the parent theme removed with remove_action
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- add_filter to specific WooCommerce Category
- How to rewrite wordpress search to work on specific category
- Where do I go to edit this area? [closed]
- How to include any template using Shortcode fuction?
- Image loading function not working on archive.php template
- Parent theme styles overriding child theme CSS [closed]
- Exclude Category ID in function
- Problem with calling custom function in a foreach loop
- overwrite code snippet from parent to child theme
- Specify multiple categories for custom post template – FATAL ERROR
- Unable to point the child theme directory even using get_stylesheet_directory()
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Child theme function.php causes fatal error
- “All posts” in the category widget
- get_template_directory_uri() links to child theme not parent
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- How to remove admin footer text from inside child theme?
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Get Attachment Category Name
- How to overwrite template.php file
- remove_action not working, even after changing priority [duplicate]
- Solution dealing with Child Theme / Parent theme functions
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- How to use parent theme functions in child theme functions.php file?
- Removing parent theme CSS without editing parent theme
- How to override this theme function in child theme
- get_template_directory() – references parent theme directory
- Child theme functions.php
- Change custom featured image size in twentythirteen child theme
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Looking for Functions File that doesn’t Exist
- Any adverse effects of adding apply_filters to a function?
- WordPress Categories: Function using custom SQL to return array of specific category IDs
- Display ACF category image on archive and single template files
- Get slug of current category in functions.php
- Include widget file in functions.php of child theme
- Get webpack to work on child theme
- how can I add filter in specfic field in my website?
- How to remove font awesome from loading in wp theme
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Display link to category over featured image
- Adding a schema code to one specific page using functions.php file
- Add Javascript code to functions.php childtheme
- How Do I Unhook This Parent Theme Function?
- Remove the ‘category’ url for one category type
- Widget is displayed in two places
- Custom Function.PHP Code Not Working on One Site
- Adding new Category does not refresh the backoffice
- How do i tweak my wp Post title base on category of the post
- How to add javascript code into Divi child theme?
- Child theme, how to cut the functions.php file into several classes?
- Replace theme function
- Setting Up Child Theme To Take Priority
- how to remove a tag in the_category function
- Menu and category highlighting for a single post
- How do I create a child theme from PowerMag theme
- Change default color scheme in twentyfifteen child theme?
- Create New User Custom Field not Saving
- i can’t use wordpress functions in ajax loaded php file
- How would I correctly implement a new if statement in a child functions file?
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Child Theme not loading multiple stylesheets
- Graphic before title – Specific Category
- Including admin-options.php file in Child Themes
- Modified functions.php in Magazine Pro theme of Genesis. 500 error
- require_once() Causing categories and tag pages on dashboard to not refrsh
- Help with is_page() and calling css for specific pages in a Child Theme
- different body classes for each category
- uninstall a theme programmaticlly
- How do I integrate my Child Theme into a Custom Template?
- Getting back a blank WordPress site following functions code edit
- Adding a meta box fields to child theme options page
- Child Theme functions.php has no effect
- Update add_image_size
- Load a Child Theme’s style.css just before the closing tag
- How To Get WordPress Categories Last Update Date?
- Is it possible to change parameters of Parent theme function in the Child theme?
- Preventing PHP Execution in Parent Theme
- Blank child theme – functions.php problem
- Why does my visual post editor break when I try to add a TinyMCE button?
- Functions.php in child theme that loads CSS file breaks website
- unregister_sidebar in child theme not working
- Unregistering custom tinymce plugin?
- Override parent theme function that is not hooked or in the functions.php file
- How to get tags and categories?
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Problem with Child-Theme using of foundation-framework [closed]
- Child Theme not working – CSS gone