Support » Plugin: Custom Post Type UI » Change page/post title to meta value or taxonomy

  • Resolved max817

    (@max817)


    Hello!
    I run a ebook store. I have the custom post permalink plugin and your CPTUI to display my posts this way: http://www.myshop.com/article/2019_214
    Therefore I added a taxonomy to the permalink structure, like this: http://www.myshop.com/article/article_id

    THe problem is, i want to show the title of the article as page title(the title you see above the browser window), but keep the article_id as permalink. Is it possible to get the page title from the post and insert it in the taxonomy name? Maybe I could get it from a meta value or another taxonomy, but i cant figure out how.
    If i change the taxonomy article_id name, i can keep the permalink, but i have about 1.000 posts.
    Thank you very much!
    Max

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    I think I’m going to need a bit more for concrete examples to mentally parse out what you’re requesting.

    For example: http://www.myshop.com/article/2019_214

    is “article” the post type slug you chose? with 2019_214 being perhaps the post title for a given post? Or is that a url mashup of say the year the post was published, and whatever 214 represents?

    Not sure if you’re using any SEO plugin, but if so, I imagine they’re tapping into the <title> output already. Otherwise, best advise would be to customize the title via the document_title_parts filter if you have title-tag theme support. https://orbitingweb.com/blog/custom-seo-friendly-title-tags-wordpress/

    Also not quite sure what you’re trying to do with regards to page title and taxonomy name. You should always be able to get a given title via something like this below, with $post_id being the ID of the post being rendered

    $mytitle = get_the_title( $post_id );

    Hi! Thank you for your fast answer!
    “article” is the custom post type and “2019_214” is the taxonomy term which is stored in the taxonomy “article_id”. Every ebook has a taxonomy with that information, so the permalink is created fine.
    Oh, I see now that AIOSEO detects the title correctly, but it isnt written in title! Now i have to dig in the seo plugin and replace the title in header with an AIOSEO command, right?
    Maybe the taxonomy is detected as taxonomy archive page… and i have to change the header in archive template?
    Thank you!

    Yippie, I found a solution!
    Wordpress passes the taxonomy directly. I had to make a rewrite and found this page for All in one SEO.
    https://www.daddydesign.com/wordpress/how-to-fix-a-custom-post-types-archive-page-title-when-using-the-all-in-one-seo-plugin/
    Then i changed the code and now it works. Thank you for your efforts 🙂
    `<?php
    add_filter( ‘aioseop_title’, ‘dd_rewrite_custom_titles’ );
    function dd_rewrite_custom_titles( $title ) {
    if ( is_taxonomy(article_id) ) {
    $post_type = get_post_type_object( get_post_type() );
    $blog_title = get_bloginfo();
    $title = get_the_title( $post_id ) . ” | ” . $blog_title;
    }
    return $title;
    }
    ?>

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    As long as it works and you’re getting the results you need, I’m happy 😀

    Let us know if you need anything else.

    Yes! Your plugin is great and your support is awesome. Keep up the good work!

    @max817 AIOSEOP dev here. Thank you for bringing this to our attention. Looks like we already have an issue for this here, but I’ve moved it up on our roadmap – https://github.com/semperfiwebdesign/all-in-one-seo-pack/issues/154. Hopefully we can add support for custom post archives soon in one of our next releases.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    thanks for chiming in with this @arnaudbroes 🙂

    @tw2113 pleasure. Keep up the good work with your awesome plugin – we use it often for testing. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.