Change separators in HTML <title></title> tags

I'm using WP 4.7.3 and a custom template set (mh-magazine). By default, WP sets a title tag like "Page title" - "Blog title". Now all I want to achieve is to replace "-" into a pipe symbol for layout reasons. So the processed HTMl should look like: My page title | My blog title I thought that this is easy to achieve, but I see I need some help since I'm not an expert in PHP or WP.
Category: Web

Getting the Image Title (not the post title)

I've tried over a dozen variations of getting the title now, with mixed results. I get an error, blank output, or the post title, but not the image title. For reference, here's the complete image code (with my latest attempt) I'm using in posts: &lt;?php if ( has_post_thumbnail() ) : ?&gt; &lt;a href=&quot;&lt;?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ), 'full', false ); echo esc_url( $src[0] ); ?&gt;&quot; title=&quot;&lt;?php the_title( $attachment_id ); ?&gt;&quot;&gt;&lt;?php the_post_thumbnail( 'full', array( 'itemprop' =&gt; 'image' ) ); …
Category: Web

SEO meta description and title tag Yoast SEO

I am using Yoast SEO and a custom header. this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there. I solved the title tag by using this code: &lt;title&gt;&lt;?php /* * Print the &lt;title&gt; tag based on what is being viewed. */ global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the …
Category: Web

How to display dynamic content in start_lvl function

I am creating a custom nav walker but having trouble outputting parent menu item title in start_lvl function. I want to output it right after the &lt;div class="dropdown"&gt; in the following start_lvl function. function start_lvl(&amp;$output, $depth = 0, $args = array()) { $indent = str_repeat("\t", $depth); if ($depth == 0) { $out_div = ' &lt;div class="dropdown-wrapper"&gt;&lt;div class="dropdown"&gt;This is where I want to output parent item title'; } else { $out_div = ''; } // build html $output.= "\n" . $indent …
Category: Web

Add Image Before Posts Entry Title

This code adds the image before all titles on the page. How do i add one single image before the posts entry title? function adt_abovetitle($title){ //Return new title if called inside loop if ( in_the_loop() ) { $x = do_shortcode('[shortcode id="'. $id . '"]'); return $x . $title; } else { //Else return regular return $title; } } add_filter( 'the_title', 'adt_abovetitle');
Category: Web

Blog Title not showing up on main Blog page

I cannot get the main blog page with the current blog to show the current blog title. It shows on all other pages, just not the current/most recent blog. Any help will be greatly appreciated. Thank you. &lt;div id="page"&gt; &lt;div id="contentleft"&gt; &lt;?php if ( $paged &lt; 2 ) { // Do stuff specific to first page?&gt; &lt;?php $my_query = new WP_Query('category_name=featured&amp;showposts=1'); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); $do_not_duplicate = $post-&gt;ID;?&gt; &lt;div class="featurepost" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link …
Category: Web

How to change the full capitals font title of my WordPress Blog?

I would like to show my WordPress blog's title as "Dummit foote 4.2.4". But I am getting all capitals as "DUMMIT FOOTE 4.2.4" What should I do to change this? I do not see any editor case in my dashboard. It was mentioned that i should change something in .css but i do not even know where to find that.
Category: Web

get_the_post_thumbnail() title and alt attributes not displaying

I am attempting to display 'alt' and 'title' attributes on a post thumbnail image, but the only attribute that actually displays as passed is 'class'. 'alt' and 'title' are missing. Any ideas what could be the cause? $thumbnail_id = get_post_thumbnail_id( ); $image_alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); echo $image_alt; //correct alt attribute text echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['class' => 'classTest'] ); //works echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['alt' => 'altTest'] ); //doesn't work echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['title' => 'titleTest'] ); //doesn't work &lt;img width="940" …
Category: Web

How to prevent WordPress from updating the modified time?

Sometimes I want to change a post a little bit, but the post was already published on my blog. The change concerns adding/removing tags or rewriting the title of the post (just to correct a misspelled word). All the things can be done using the admin panel by pressing "quick edit". Unfortunately, the action updates the "modified time". I'm using the "modified time" so people would know whether a post was modified or not. But I want to disable the …
Category: Web

How to select a category automatically based on a word in WordPress post title?

I am working with an auto-posting blog where the articles come through RSS Feed. There are lots of posts publishing every day automatically. Now I need to get a category automatically based on a word in the WordPress post title. For example: I have a category: &quot;New York&quot; and &quot;Florida&quot;. If any post has the word &quot;New York&quot; in the title, then the category &quot;New York&quot; will select automatically during publishing. Similarly, if any post has the word &quot;Florida&quot; in …
Category: Web

Append text after wordpress title

I would like to know is there a hook in wordpress to edit prefix and postfix of the_title in wordpress. The code in content.php the_title( '&lt;h1 class="entry-title"&gt;', '&lt;/h1&gt;' ); I would like to add content after the closing tag of h1. When I use the_title hook the content is added inside the h1 tag. Like to know how to add outside the h1 tag by using action hook (fron the plugin).
Category: Web

My posts page is missing the page title

I cannot for the life of me figure out why a title is not showing up on my blog page. I want to be able to have a title and maybe even some descriptive text below instead of just jumping into the posts. I don't really have experience with .php and behavioural coding so any help would be majorly appreciated. I am using the XTheme PRO. http://swift6000.staging.wpengine.com/news/ Thanks, Yana
Category: Web

Set document title through shortcode plugin

I have a plugin a web hosting company made for us, and I need the &quot;current challenge&quot; page to show the challenges name as the document page title. Currently it just displays the page name &quot;Current Challenges&quot; that contains the shortcode to show the challenge. The challenge system only had a show challenge list function, which I just limited to 1. But now that I am trying to add the title I made a new function to just show latest …
Category: Web

How to auto update post title and slug with category name when post status is updated

I need to auto update post title and slug with category name every time when post status is updated. Some function like this but with the correct code.... add_filter('wp_insert_post_data','reset_post_date',99,2); function reset_post_date($data,$postarr) { $data['post_title'] = How to add category name here? //also update the slug of the post for the URL $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'] ), $postarr['ID'], $data['post_status'], $data['post_type'], $data['post_parent'] ); return $data; } EDIT I tried by myself but without success. Now I'm trying to run this function only …
Category: Web

Which filter affects the 'entry-title' post class

I created a plugin setting a $var to true if the post belongs to category 'a', and set the same $var to false if the post belongs to category 'b', it works and I can get the correct value depends on the category what I need is to find a filter helps me to add an extra text to the entry-title post class so I can change post title align or color if if the post category is a without …
Category: Web

How to get all post titles starting with numbers and symbols?

I want to get all posts which are starting with a number (0-9) or symbols, in a list. I managed to get it work for letters, but this one is harder for me. Can someone help me out please? I tried adding this in my existing code, but it didn't work: $this_char = strtoupper(mb_substr($post-&gt;post_title, 0, 1, 'UTF-8')); if (strpos('0123456789',$this_char) !== false) $this_char = '0-9'; if ($this_char != $last_char) { This is my code: &lt;?php $first_char = 'A'; $postids=$wpdb-&gt;get_col($wpdb-&gt;prepare(" SELECT ID …
Category: Web

How do I show the post title if an advanced custom field hasn't been used?

I've got an archive page for to display custom post types. Within the WP_Query that displays the custom posts types I want to display an ACF (Advanced Custom Field) or, if the user hasn't filled out the ACF, then the title should appear. I've tried this and the ACF field displays ok, but when it's not filled out, the title doesn't display, just the content of the post instead. Here's the code I have (just for the title section): &lt;?php …
Category: Web

struggling to order by title

i have the following page https://gundog.world/my-favorites/ (to view,user=stack pass=exchange) the page functions correctly but i am trying to put the generated list into ascending order by post title. i have tried numerous $args but not seem to be correct. can any one see any obvious errors? please be kind this is only a hobby. many thanks in advance the list generated are post types ,i am usinng the titles of the posts plus a few fields. &lt;?php // If this …
Category: Web

Change the Title Tag of Search Products Page

Yes, i've seen some answers on different questions but they didn't fit to my situation. My theme has title tag enabled. The title in the wp_get_document_title() function is different than the real title in my Search Page, which is "You Searched For %search% - %site_name%". I need to translate the title, nothing more. I searched for You Searched in functions_php and every other .php file in woocommerce that has product or search related and couldn't find it. I would appreciate …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.