• nwarrenfl

    (@nwarrenfl)


    How can i display all the articles belonging to a tag but only from a certain category?

    In fact i have a page that lists all artists, each artist is a tag. Each artist has songs and each song belongs to a specific category. I want to be able to show users all articles (songs) from a tag (artist) belonging to a specific category.

    How can i do that? Thanks in advance.

    Here’s my tag.php file:

    [code moderated – please use the pastebin]

    Also i had to hook pre_get_posts to order by title and ascending:

    function my_pre_get_posts($query)
    {
    	if(is_tag())
    	{
    		$query->set("orderby", "title");
    		$query->set("order", "asc");
    	}
    
    	return $query;
    }

  • The topic ‘Show articles from a certain category and tag’ is closed to new replies.