• Charlar

    (@charlar)


    Hi, I’m struggling to hide the ‘Project Type:’ prefix title in the site: https://bit.ly/3gkdfIi. I searched many forums and was able to create a child theme and add a custom functions.php to it. With an example code below, I was also able to hide the prefix for normal ‘posts’ but not for the Portfolio ‘project types’ which I’m using. This is the code for hiding post prefixes:

    function prefix_category_title( $title ) {
    if ( is_category() ) {
    $title = wp_title( ”, false );
    }
    return $title;
    }
    add_filter( ‘get_the_archive_title’, ‘prefix_category_title’ );

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • seabear211

    (@seabear211)

    hi can you take your site off coming soon? 🙂

    Hi @charlar,

    Can you once check your site URL and provide us the correct URL of your website?

    Thanks.

    Thread Starter Charlar

    (@charlar)

    Hi, sure here it is, for e.g. this page: https://bit.ly/2M1MZVb

    • This reply was modified 6 years ago by Charlar.

    Hi @charlar,

    To get the result as you desired, you must create the child theme. You can get knowledge about a child theme and its process to create, from the link below.
    https://themegrill.com/blog/tutorial-creating-wordpress-child-theme/

    Now that if you’ve created the child theme, then add the below code in a file name functions.php.

    function prefix_category_title($title)
    {
    	if (is_category()) {
    		$title = single_cat_title('', false);
    	}
    	return $title;
    }
    add_filter('get_the_archive_title', 'prefix_category_title');

    Thanks and Regards,
    Ankit

    Thread Starter Charlar

    (@charlar)

    Thanks for your reply Ankit. I already had the child theme and custom functions.php installed so it was not any trouble.

    However, I tried the code above but it’s not working. I’m using the ‘Portfolio’ feature of WordPress as I mentioned and this seems to be the reason why, as I tested it and it worked on ‘Post’ categories.

    Here is the same page with the above code applied: https://bit.ly/2M1MZVb

    Hi @charlar,

    Please contact us via our official site https://themegrill.com/ chat support so that we can provide you with the solution in real time and it will be easy for you to implement.

    Thanks and Regards,
    Ankit

    Thread Starter Charlar

    (@charlar)

    Thanks Ankit, I was able to solve it with the help of your chat support. Appreciate it! Leaving the working code here for people that might need it:

    function prefix_category_title($title)
    {
    if (is_tax()) {
    $title = single_term_title(”, false);
    }
    return $title;
    }
    add_filter(‘get_the_archive_title’, ‘prefix_category_title’);

    Hi @charlar,

    Please do let us know if you have any further queries regarding the theme.

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Title prefix ‘Project Type’’ is closed to new replies.