[Resolved] Custom filter for a specific tag archive

Home Forums Support [Resolved] Custom filter for a specific tag archive

Home Forums Support Custom filter for a specific tag archive

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #468061
    Andre

    Hi,

    We are using 2 tags for our list of post and on a specific tag archive page, we would like to display only the pictures from the post.

    Is there a way to add a filter in the Code Snippets plugin that said something like:

    if archive page && tag=XX
    disable title and excerpt

    Or is there a better way?

    Here are the 2 pages:
    http://pro-actif.ca/portfolio/ (would like picture only)
    http://pro-actif.ca/articles/ (layout is ok)

    Thank you very much, we are using this template for over a year and are very impressed!

    #468081
    Leo
    Staff
    Customer Support

    Hi there,

    These should be the filters you are looking for:
    https://docs.generatepress.com/article/generate_show_excerpt/
    https://docs.generatepress.com/article/generate_show_title/

    and the conditional tag should be something like:
    if ( is_archive() && is_tag( 'Tag-Name' ) )
    https://codex.wordpress.org/Conditional_Tags#A_Tag_Page

    #468856
    Andre

    Hi Leo,

    I tried this in my Code Snippet :

    add_filter( ‘generate_show_title’,’hide_title’ );
    function hide_title( $hiding )
    {
    if ( is_archive() && is_tag( ‘portfolio’ ) )
    return false;

    return $hiding;
    }

    But it’s not working on page http://pro-actif.ca/portfolio/

    What am I doing wrong?

    Thank you for the quick reply.

    #468862
    Andre

    If I may, I have another quick related question:

    Is it possible to have an archive page that is a combination of 1 tag + 1 category?

    In this exemple, would it be possible for me to have 3 portfolio page (portfolio is a tag in my structure), 1 for each category of post that I have?

    Right now, http://pro-actif.ca/portfolio/ display all post with tag=portfolio from all post.

    Thank you.

    #468923
    Leo
    Staff
    Customer Support

    Try this for the filter:

    add_action( 'after_setup_theme', 'lh_remove_tag_title' );
    function lh_remove_tag_title() {
        if ( is_tag( ‘portfolio’ ) ) {
            add_filter( 'generate_show_title', '__return_false' );
        }
    }

    The other request is more difficult, you might want to check out Tom’s WP Show Posts:
    https://en-ca.wordpress.org/plugins/wp-show-posts/

    #469400
    Andre

    Hello Leo,

    The code is not working, but I found a workaround based on your input. As for WP-Show-Post, I am already using this plugin (good one), but was wondering for a more “built-in” solution.

    Thank you for your support.

    #469518
    Leo
    Staff
    Customer Support

    Glad you figured out!

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