looks like your elseif statement isn’t correct.
try something like :
if ( is_single() || is_page() ) {
echo get_the_title();
} elseif ( is_home() || is_front_page() ) {
echo "Predefined Name";
} else {
echo wp_title;
}
Related Posts:
- Show content if parent page has children
- Current post’s author name in the author meta tag
- Conditional statement for parent, child and grandchild pages
- Trying to use Ternary operators with WP Conditionals
- When is is_admin() available?
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- How to enqueue CSS and JS only on specific template?
- how could I load a different template part by page
- WordPress, AJAX and pre_get_posts using conditional tags
- If tag equals then show else show
- Conditional statement for dates
- How can I display a div ONLY if it is not a certain term page
- Don’t show certain div on front page?
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- “if parent category is” conditional?
- Conditional for Post Format
- conditional: if is page, and all subpages
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- page 1 is not paged
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Add code to the header of posts by particular author
- Display specific page if user signed in
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- If Month=Particular month display content [closed]
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- Conditional in foreach loop is outputting content twice
- Advanced custom fields Repeater conditional statement not working [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- if is specific custom post in cpt
- advanced custom fields: repeater field within conditional statement [closed]
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- Why isn’t WordPress part of Framework Interop Group?
- Is there a way to use the WordPress users but without loading the entire WordPress core?
- How to protect own PHP code from WordPress updates
- get_template_part not working with ajax
- Javascript code inside “” in core WordPress files .php
- Placing the_content inside shortcode not working
- Exclude posts from homepage having a specified tag
- How can I add an alert (like the old javascript alerts) to my WP page?
- Change output based on text field value
- Is it acceptable to treat a filter like an action?
- Where to place PHP code that inserts (or doesn’t insert) menu item?
- Fetch post block/field data as JSON with WordPress API
- How to design a table based on css values set from admin/dashboard
- Get the post ID and display the images
- Where to find documentation for CPT block template? (PHP)
- Media upload ERROR Message Showing in BOTTOM of the page wordpress
- Setting default category base on theme activation
- How to manually change current date to post date in frontend?
- WordPress Woocommerce – Product Type [closed]
- Why does wp_head hook my functions to the beginning of my source code?
- Noscript not working as it should in wordpress site
- Pass argument to event hook
- Translate wordpress date from Italian to English
- wp_insert_post: array only. wp_update_post: array|object (?)
- What is the difference in the WP memory limits?
- Different Subdomain changes page content
- Removing the comment function within wordpress
- Bootstrap Carousel HTML structure and funny output [closed]
- How to remove custom style from source?
- How to add post classes?
- Extract and display user infromation on an automatically created page
- Why won’t this wpdb get_results query return results?
- Why doesn’t global $wp_query not get hooked?
- How can I assign separate stylesheets to different pages?
- Using multiple variables to assign categories to an array
- Show Custom Menu Name in WordPress 3
- Add a custom WooCommerce settings tab with sections
- No more get_option(‘date_time’) in WordPress 5.5?
- Create category after theme setup and modify the default one
- PHP error on local server install
- Prepared DB Query from _POST array
- How to include non-users in wp-admin redirect?
- Static home page ignored
- How do I routinely extract the thumbnail of the most recent post?
- WP_Post is not from correct array
- Showing custom field contents without listing description
- WordPress create new on site when a new page is added
- Why does a meta_query break this WP_Query?
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Create an if statement based on page_id
- Require Credits Footer
- Undefined variable notice [closed]