How to modify title tag in a plugin?

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.

How can I prevent the Search Results Page from changing title?

You can replace: <h1 class=”site-title”><?php echo get_the_title($post->ID); ?></h1> With: <h1 class=”site-title”><?php _e( ‘Search results for’, ‘theme-textdomain’ ).’: ‘ . get_search_query(); ?></h1> But obviously only in search pages. I suggest to move the <h1> element to each template you may need instead of include it in the general header.php template. It is up to you but … Read more

conditional widget title

Not a lot to go on here! I’d suggest registering 2 different sidebars – one for the category 3 posts and one for the rest. Then you can add you widgets and modify them as required.

Replace Underscore (_) on Space ( )

You are correct, you need to use str_replace. See details here So the correct code would be: $postData = array( ‘post_title’ => str_replace(‘_’, ‘ ‘, $attachment->post_title), ‘post_type’ => ‘post’, ‘post_content’ => $image_tag, ‘post_category’ => array(‘0’), ‘post_status’ => ‘publish’ );

Setting Page Title Yoast

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

What change does this code need to include title of parent?

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

How to disable site title and description when custom header is uploaded on the customizer?

<div class=”table-cell”> <?php if ( has_custom_header() ) : ?> <?php the_custom_header_markup() ?> <?php else : ?> <h1 class=”blog-title”><?php bloginfo(‘name’); ?></h1> <h5 class=”blog-tagline”><?php bloginfo(‘description’); ?></h5> <div class=”image-title”><img src=”https://wordpress.stackexchange.com/questions/248807/<?php bloginfo(“template_url’); ?>/images/image.png” /></div> <?php endif ?> </div>

How to disable Publish button on Edit post if post title exists

You can achieve this by adding post.php to your conditional check before enqueuing your script. NOTE: This might effectively disable the ability to update posts. add_action(‘admin_footer’, function() { global $pagenow; if ( !$pagenow || !in_array($pagenow, array( ‘post-new.php’, ‘post.php’ )) ) return; // only enqueue when writing/editing posts ?> <script> jQuery(document).ready(function($){ $(document).on(“change”, “#titlediv #title”, function(e){ var … Read more

Blog Post Title apearing twice

You need to remove the archive description automitically generated by genesis. Look in your archive page template and remove(*) something like do_action(‘before_archive_posts’); (*) You can update your question with your archive template code. As I don’t use this theme, I don’t know the right name, and more details you could remove this action easily in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)