Add Placeholder in WordPress Editor Content Box
Add Placeholder in WordPress Editor Content Box
Add Placeholder in WordPress Editor Content Box
Ok, I found the method by myself. This is the code: //… elseif (is_page() || is_single()) { //Page and Post Title global $post; $metatitle = get_post_meta($post->ID, ‘metatitle_value_key’, true); if ($metatitle) { echo stripslashes($metatitle); } else { the_title(); } } elseif (is_home()) { //Using is_home for the blog page //And using get_queried_object $page_object = get_queried_object(); $metatitle … Read more
I believe this forum post in the WordPress.org Support Forums will help. If you’d like me to research it more, I’ll update this post as I go… I hate telling someone to disable something without having a fix when it’s re-enabled.
Ok solved. <?php if ( is_front_page() && !is_home() ) :?> <h1><a href=”https://wordpress.stackexchange.com/questions/175971/<?php echo esc_url( home_url(“https://wordpress.stackexchange.com/” ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></a></h1> <?php elseif ( is_home() && get_option(‘page_for_posts’) ): ?> <h1><?php echo apply_filters(‘the_title’,get_page( get_option(‘page_for_posts’) )->post_title); ?></h1> <?php else : ?> <h1><a href=”<?php echo get_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(”); ?></a></h1> <?php endif; ?> … Read more
Well, I never got any input on this and ended up going with the function sanitize_title which is more restrictive than I want (processes the title to be used in a URL — essentially returns a slug for the post), but it’s the best solution I’ve been able to find. By running both the 3rd-party … Read more
You can’t force Google to use your title, they may change it in their SERPs: […] we have algorithms that generate alternative titles […] Google’s generation of page titles and descriptions (or “snippets”) is completely automated and takes into account both the content of a page as well as references to it that appear on … Read more
Your code is fine, the only problem here is a syntax error. Always remember to remove any spaces between the opening and closing tags – otherwise your code will fail. Example: <h2> <a href=”#” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”> <?php the_title(); ?> </a> </h2> Make sure to read the WordPress Codex about the_title_attribute() … Read more
What I actually ended up doing was to use filter document_title_parts. https://developer.wordpress.org/reference/hooks/document_title_parts/ I just unshifted a value to the array. I don’t think the documentation actually is very clear about that. And this method still don’t work with Yoast SEO installed.
It sounds like you’re trying to modify document’s <title> tag as opposed to the post titles typically wrapped in <h1>/<h2> tags, which you’ve already accomplished. If the theme you’re using implements titles in the WordPress 4.4+ manner, you can use the document_title_parts filter: /** * document_title_parts * * Filters the parts of the document title. … Read more
You can get all parent post id by get_post_ancestors function. add_filter( ‘document_title_parts’, ‘change_wp_title’, 20, 1 ); function change_wp_title( $title ) { global $post, $paged; $grappig = $title; // 404 if ( is_404() ) { $title[‘title’] = ‘file not available’; } elseif ( is_singular( ‘schedule’ ) ) { // get all parent post’s id $parents = … Read more