I just tried it with this code and it all worked as it should:
<?php if ( is_home() ) : ?>
<meta name="description" content="Your home page meta description" />
<?php else : ?>
<meta name="description" content="Your non-homepage meta description" />
<?php endif; ?>
You want to be sure there’s not a space between <?
and php
(<?php
).
Related Posts:
- How Does One Change The Meta-Description Of Home-Page?
- Is tag default in WordPress?
- How to add post meta fields to an article’s as meta elements
- How can I remove image taxonomy pages from my theme and from Google?
- Show Yoast SEO meta tags in Custom WordPress Templates (Theme)
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- What matters should I care to make my theme SEO friendly? [closed]
- Is it ok if I use this tag?
- Solutions for generating dynamic javascript / CSS
- Custom single template for a specific category
- Get the first image from post content (eg.: hotlinked images)
- Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?
- Nested comments ignored for max per page in wordpress
- wp_nav_menu sort order?
- How does WordPress decide what template to use as frontpage
- get_option function
- Twenty Eleven home page show only excerpt
- Snippet: Use classes instead of inline styles for text alignment
- Make a custom theme translate-ready
- Grab the first paragraph of each post
- Set Expiration Date of a Post from the Frontend with wp_insert_post
- How to Handle CSS for Multiple Header header.php Files?
- Resources for a complete beginner to learn to work professionally with WordPress [closed]
- “Cheatin’ uh?” error message on multple theme directories
- How to tell if the user is an admin?
- Adding WordPress colorpicker in widget settings
- “Display Site Title and Tagline” checkbox not working?
- What is wrong with this code I have to make a blockquote shortcode
- Removing title tags from each page
- How to attach different React Components to different Dom Roots using the new WP wordpress/scripts webpack/babel
- Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?
- Remove Cookies From WordPress Core
- Is it necessary to prefix every css class in a theme framework?
- Add theme templates for child categories into the template hierarchy
- Where can I access my custom page template?
- How to display posts in hyperlink with nested slugs?
- Check if tag, category or author on archive.php
- Developing WordPress Theme using CSS framework like Bootstrap
- How to make Isotope and WordPress work together?
- WordPress empty Nav Menu error
- Getting custom posts by post id from cutomizer text input
- Theme Javascript.php Overwritten Nightly [closed]
- Is there a way to visualize / print out which templates were used to render a given piece of UI?
- How to use widget in a widget-less WordPress theme?
- How to wrap all titles generated by Gutenberg “Heading” block with tag
- In creating a theme, how can i allow a user to change an image outside post/page content?
- Unique design inside a specific category’s url
- What Does “Cannot modify header information?” Mean
- Rewrite the HTML markup of wp-login.php
- Are there any caveats to compiling all of my theme’s SCSS into the style.css file in the theme root?
- SVG in list-style-image breaks when adding fill
- What template file is used for homepage pagination?
- WordPress theme resource won’t load over VPN
- Templates without a loop, best practice?
- Alignment Problem [closed]
- How the redirect_to parameter is added to wp_login.php when trying to access wp-admin?
- Clearing dummy data before launch
- Multiple editable areas
- Converting a static HTML template into a WP theme – How do I specify page content?
- Unwanted empty line at the beginning of document
- Why is my container argument not working for wp_nav_menu() [closed]
- How to display date of blog creation
- Translate a theme with a PO file
- All pages are the same
- How can I get the featured image or the first image for a post/page and display it as a banner?
- Theming media inserts
- How to Split loop in multiple column in archive page
- wordpress script_loader_tag in function.php
- Why not works the search.php file?
- My wordpress theme name isn’t updating straight away
- Warning: This page allows direct access to your site settings. You can break things here. Please be cautious!
- Adding a second logo next to the main one in header
- Looking to create an “update theme” functionality for a custom front-end dashboard
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- How to get next post and previous post URL in loop, single.php My WordPress 4.9.6
- Import settings from another theme
- Load multiple css simultaneously using functions.php
- bbPress: modifying template for forum index
- control posts order by select option
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Can I use WP Multi-site on a sub-domain with a different theme but use all the original site’s posts/pages?
- How to Apply Category Filter to Pagination
- How do I use the add_query_arg function in a template tag like previous_post_link?
- Load get_page_templates into select menu
- Get all Custom Post Types
- Let users to add any number of input fields in the theme option page
- how to make a new page affected by a theme’s index.php layout?
- Add custom field to existing meta box?
- Theme Options Doesn’t Work On WP Multisite
- WordPress two sidebar layout or theme
- add_action not working in header?
- Standard Way To Do Custom Work Within A Page?
- Subsite theme mystery man replacement with Buddypress on main site [closed]
- Theme layout for home page [closed]
- Is there any way to show child theme in theme detectors?
- Recent posts with comment count in “Sidebar” template [closed]
- HTML to WORDPRESS [closed]
- Creating image grid on products page in wordpress
- Insert gutenberg blocks into template
- How to make it so I can “use” template parts in (classic/full) site editor