The is_page
function accepts any of the page ID, the page title or the page slug. It looks like you’re trying to give it an URL fragment instead.
You say that ‘contact-us’ is the page slug for your contact page, so try
if (is_page('contact-us')) {
without the forward slashes, i.e. passing the page slug, instead.
Related Posts:
- Enqueue less file not working in child theme?
- Adding tawk.to code just before body tag on functions.php file
- jQuery code not working when included in functions.php
- linking stylesheets and scripts with functions.php
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Enqueing External JS on the remote server JS
- Enqueueing a code block from an options framework
- How to change order inside foreach using wp_enqueue_script?
- Enqueue sripts and styles only if function is called
- Adding Gravity Form With if(is_page) Is Not Working
- Warning: filemtime(): stat failed for wp_
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- WordPress Infinite Scroll without using any plugin
- How to remove a metabox from menu editor page?
- How to add active class to custom menu using while loop and wp_list_pages
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- Disable External Pingacks on WordPress Posts and Only Allow ‘Self Pings’
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Create an array from an array
- Using wp_get_image_editor in a standalone script
- Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products [closed]
- Can I change a variable in a content part while calling it?
- WordPress Redirect: Default Password Reset URL [duplicate]
- Shortcode return function with link href inside PHP
- Can’t get page content in WordPress
- Function not working at one place
- How to prevent WP_Query function from returning all posts when empty?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- How to call plugin function per site in a multisite?
- foreach loop still echoes array
- dynamic dependent select dropdown
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- getting logged in user info (wp-load.php) from parent directory
- wp-comments-post.php file returns a blank page
- Add .htm extention to a custom taxonomy
- Custom gallery in wp3.5
- Noscript not working as it should in wordpress site
- Correct way to enqueue page specific CSS file
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Pagination broken on is_front_page()
- Content filter won’t work
- Why does the post_type_link hook everything twice?
- Warning: in_array() null given in PHP function
- Use post ID in functions.php file adminside
- use loop to return blog details
- How can I count ACF sub_field with a certain value
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- Missing a text-domain esc_attr_e
- Custom posts password protect
- How to get post category list as select in front-end?
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Function to call either single post or category
- Execute PHP code only with specific user role
- WP Container Displaying Only on First Page of Archive
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- PHP function for horizontal Woocommerce thumbnails and badges
- Add Pre-Defined Value to Click Counter in WordPress
- Is there a PHP function that will return the block ID generated by WordPress?
- Creating a Function and Call It
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- How to move a post from one category to another
- Show data obtained from a function and place it in a shortocode function
- how to add custom select field to wordpress edit page
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- how to use 2 index.php file One for mobile and one for desktop
- WP_Query To Display Product Of Brand On Taxonomy Page
- oembed facebook link?
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- Matching multi user
- Add disclaimer before certain posts and pages
- Where can I find the declaration of `$_wp_theme_features`?
- redirect 301 with special character like WIX site “#!”
- auto metakey value on post tile
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- How I can add div to menu?
- Modify category archive page loop on functions.php
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Check if values exists DB
- Overwriting a Shortcode
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Dynamic Email Handler with ‘header (“Location: …’
- WooCommerce: write featured image dimensions to custom fields in product’
- Generate and upload screenshot as featured image for user-submitted post
- transition_post_status hook, works – but not if the post is new
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page