Page Title Dependant On Input?

Your best bet may be to use existing WordPress filters to modify your page title. For your needs, the the_title() filter would probably be your best best. Here’s a link to a pretty good tutorial on using it.

Limit title length

It’s because you’re not using the filter correctly. The the_title filter passes the title to be filtered as the $title argument, but you’re overwriting it with this code: global $post; $id = ($post->ID); $title = get_post( $id )->post_title; That code’s completely unnecessary because the title is already available in your function: function max_title_length( $title ) … Read more

Add text to the first “title”=>get_the_title($post->ID), and shorten

there are many ways to do this, but frankly, this is not a wordpress question it’s a php question. here is your code doing what you asked for $imageAttr = [ “class” => “alignnone size-medium”, “alt” => get_the_title(get_the_ID()), “title” => __(‘hi’, ‘theme-textdomain’) . ‘ ‘ . wp_trim_words(get_the_title(get_the_ID()), 2), ]; $variable = [] is just a … Read more

I want to add number after post tittle for each category

Here’s an untested edit of your code to use the post’s first category in the count: add_action(‘the_title’, ‘dk_auto_numbering’); function dk_auto_numbering($title) { $post_ID = get_the_ID(); $the_post = get_post($post_ID); $date = $the_post->post_date; $maintitle = $the_post->post_title; if ($maintitle == $title && $the_post->post_status == ‘publish’ && $the_post->post_type == ‘post’ && in_the_loop()) { $categories = get_the_category($post_ID); if (is_array($categories) && count($categories) … Read more