[Support request] archive question

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support archive question

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Tom 4 days, 8 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6745

    Jason
    Participant

    Hi,
    Thanks again for the help on my post here (https://wpshowposts.com/support/topic/caching-issues-categories-not-styled-as-assigned/)
    I’ve got a few related questions. I was all set to do the same routine for the author.php file when I realized there is no author.php file. And now author & tag archives come up with “no posts”

    So if I wanted to extend the same functionality of this code snippet to author, tags (not sure what else to list) can I modify this and place it right below to build a stack of if-else statements?

     if ( is_single() ) {
      $cats =  get_the_category();
      $cat = $cats[0];
      } else {
      $cat = get_category( get_query_var( 'cat' ) );
    					}
      $cat_slug = $cat->slug;
       wpsp_display( 13607, 'tax_term="' . $cat_slug . '"' ); 

    I’ve looked in the includes folder for similar get_the_ functions, but no luck. Would it be get_the_author() and get_the_tag ?
    Hopefully I’m not missing some other important aspects of the above code.
    Sorry if this is pushing the envelope of what WPSP was designed for, but I just need some examples and pointers sometimes to get going. Thanks again in advance.

    #6750

    Tom
    Keymaster

    You can actually copy the archives.php and rename it as author.php or tags.php in your child theme.

    Then you can set the lists to whatever you like.

    Let me know if that helps or not 🙂

    #6794

    Jason
    Participant

    Yes, I still need some help. Can we start with the tag archive?

    I’m trying to use the same format as the category snippet but it doesn’t work.

    Here’s what I have:

     if ( is_single() ) {
      $tag = get_queried_object();
      $tag = $tags[0];
       } else {
      $tag = get_tag( get_query_var( 'tag' ) );
    					}
     $tag_slug = $tag->slug;
    wpsp_display( 13607, 'tax_term="' . $tag_slug . '"' ); 
    #6796

    Tom
    Keymaster

    Try this to get the tag slug:

    $tag = get_queried_object();
    $tag_slug = $tag->slug;
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.