Auto append text after the title?

If I understand you correctly, then the_title hook should help you. You can assign your filter to it and modify the title as you wish: add_filter( ‘the_title’, function( $title, $id ) { return $title . ‘ – Lorem ipsum’; }, 10, 2 );

Single post pagination

It’s possible to modify the content pagination with the content_pagination filter. Here’s a way to always display the content of the first page: /** * Content Pagination: Always display the content of the first page */ add_filter( ‘content_pagination’, function( $pages ) { // Nothing to do if there’s no pagination if( count( $pages ) <= … Read more

How to add … after a particular word/character limit to the title

the_title() prints/retrieve the title while get_the_title() retrieve the title. So your code should be something like this. <div class=”case-breaking__content”> <p> <?php $out = strlen(get_the_title()) > 50 ? substr(get_the_title(),0,50).”…” : get_the_title(); echo $out; ?> </p> </div> Note you can use the_title() but it is not recommended here to keep the code clean. <div class=”case-breaking__content”> <p> <?php … Read more

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

If in doubt, check the documentation first: https://www.advancedcustomfields.com/resources/get_field/ Check if value exists This example shows how to check if a value exists for a field. $value = get_field( ‘text_field’ ); if ( $value ) { echo $value; } else { echo ’empty’; } So, in for your case you would need to use: <?php $short_testimonial … Read more

Display image title and caption inside a single post

I got a few minutes and made the custom code for you. Copy and paste this in your themes functions.php remove_shortcode(‘gallery’, ‘gallery_shortcode’); add_shortcode(‘gallery’, ‘gallery_shortcode_custom’); function gallery_shortcode_custom( $attr ) { $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr[‘ids’] ) ) { // ‘ids’ is explicitly ordered, unless you specify otherwise. if … Read more

Problem dynamically generating an all purpose title tag

I wound up fixing it like this. All pages now work. But it looks …well …ugly. <?php if (function_exists(‘is_tag’) && is_tag()) { single_tag_title(‘Tag Archive for &quot;’); echo ‘&quot; | ‘; } elseif (is_archive()) { wp_title(”); echo ‘ Archive | ‘; } elseif (is_search()) { echo ‘Search for &quot;’.esc_html($s).’&quot; | ‘; } elseif (!(is_404()) && is_single() … Read more