Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1306630

    Hello,

    In continuation of this ticket: https://kriesi.at/support/topic/custom-post-archive/

    I was given the below code to display custom taxonomies on postslider.php, problem is i don’t want to display all taxonomies. For example i want to display ‘brand’, ‘condition’, ‘size’ etc, but I don’t want to display the ‘Show Ads’ taxonomy since i use it purely for administration purposes. Is there a way i can add a filter to remove one or two particular taxonomies?

    $taxonomies = get_object_taxonomies( get_post_type( $the_id ) );
    $cats = ”;
    $excluded_taxonomies = array_merge( get_taxonomies( array( ‘public’ => false ) ), array(‘post_tag’,’post_format’) );
    $excluded_taxonomies = apply_filters( ‘avf_exclude_taxonomies’, $excluded_taxonomies, get_post_type( $the_id ), $the_id );

    if( ! empty( $taxonomies ) )
    {
    foreach( $taxonomies as $taxonomy )
    {
    if( ! in_array( $taxonomy, $excluded_taxonomies ) )
    {
    $terms .= get_the_term_list( $the_id, $taxonomy, ”, ‘, ‘, ” ) . ‘ ‘;
    }
    }

    $output .= $terms;
    }

    #1306634

    Also,

    The code given to me is showing duplicates. For example the first post shows all the taxonomies once, the second post shows all the taxonomies of the first post AND second post, the third post shows the taxonomies of the first, second and third post etc.

    #1306842

    Hi,

    Thank you for the inquiry.

    Did you revert the postslider.php file back to default before adding the latest code? To exclude certain taxonomies, you have to include it in the array in this line.

    $excluded_taxonomies = array_merge( get_taxonomies( array( ‘public’ => false ) ), array(‘post_tag’,’post_format’) );
    

    Include the name of the taxonomy that you want to exclude in this array.

    array(‘post_tag’,’post_format’)
    

    Best regards,
    Ismael

    #1307081

    Thanks i was able to edit the array and remove unwanted taxonomies, however the duplicates are still there.

    Yes i reverted the to the original postslider.php before updating the new one in my child theme. I even tried downloading the theme again and copied the fresh file to my theme to make sure its the same as the original. I used an online diffchecker to make sure that the two files are exactly the same except for the code to show the taxonomies.

    #1307406

    Hi,

    Thank you for the update.

    The login details from the previous thread is no longer working. Please post another login account so that we could check this properly again. Make sure that the Appearance > Editor panel is accessible.

    Best regards,
    Ismael

    #1307408

    I have reset the password below. It shouldn’t expire, its not a temporary account.

    #1307665

    Hi,

    Thank you for the update.

    We just realized that the same code already exist in the file, so we removed the modification and edited the existing one. You can find it around line 817. The categories are now displaying above the post title.

    Best regards,
    Ismael

    #1307669

    Perfect!

    Thanks Ismael everything is working great

    #1307841

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1307864

    all good you can close this

    #1307873

    actually one more thing,

    is there a way to tell which template i need to edit for specific archives? the archive pages for my custom posts are not displaying the ‘read more’ link. For example, compare the home page which uses postslider.php, to the page linked below

    #1308436

    Hi,

    Glad to know that it is working correctly.

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

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