Please I want to prefix my WP posts title according to each category

You have already mentioned the function wp_title(). Right before outputting the title, it passes its value through the filter wp_title, which can be used here to prepend with additional information. add_filter(‘wp_title’, ‘WPSE_20181106_prepend_title’, 10, 3); function WPSE_20181106_prepend_title($title, $sep, $seplocation) { // not a single post if (!is_singular(‘post’)) { return $title; } // IDs of categories that … Read more

Display last updated in

2 ways to do this. Method 1. Modifies the title output everywhere. In your theme’s functions.php file, put the following code: function cc_month_in_title($title, $id) { $month = get_the_modified_date(‘ F, Y’, $id); $title = $title.$month; return $title; } add_filter(‘the_title’,’cc_month_in_title’, 10, 2); Method 2. Modifies the title output only in the specific template. In this case, open … Read more

Wrap the 2 firsts words of title with a

You can do that like this: function add_label_to_post_title( $title=”” ) { global $post; if( ‘post’ == $post->post_type && trim( $title ) != “” ){ $title_words = explode( ” “, $title ); $word_count = count( $title_words ); //Sets how many words should be wrapped $words_to_wrap = 2; $last_word_index = $word_count > $words_to_wrap ? $words_to_wrap – 1 … Read more

Changing title using filter not working with argument

Maybe you can add a higher priority to your filter as the 3rd parameter of the hook: /** * Modify the data * * @param String $data * * @return String $data */ function change_title( $data ) { global $post; return ‘Page ID ‘ . $data; } add_filter( ‘the_title’, ‘change_title’, 15 ); The default priority … Read more

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