WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] All blog posts showing in my specific category instead of its specific's. (13 posts)

  1. pwoperART
    Member
    Posted 1 year ago #

    Hello!

    I'm new to WordPress, i've been customizing my theme last days and i've almost finished the blog.

    But i have a critical problem, the menu is not working properly :(

    I have some categories (i will have much more, around 50) in the menu, but when i click one, all my blog posts appears, instead of the specific posts of this category. That's quite frustrating... I usually don't post because i find the problem with my best friend Google, but this time i didn't find any solution to my problem.

    This is the link to the blog: http://pwoperart.com

    I've heard about a category.php file, am i in the right direction?

    Well, i'm a PHP dumb, really, i only understand HTML/CSS. :(

    If someone could give me some help to solve this problem it would be appreciated, really.

    Thanks very much to read this post. :)

  2. mbrsolution
    Member
    Posted 1 year ago #

    Hi can you give me an example on what you are trying to do?

    When I click on Artist >> Digital Painting >> Levi Hopkins I see all the art for Levi Hopkins correct.

    Then when I click on Michal Ivan I get the same art is that what you mean?

    So you want to only view the art a per artist, correct?

  3. pwoperART
    Member
    Posted 1 year ago #

    Hi mbrsolution, thanks for trying to help,

    The example you gave, it doesn't work with me, when i click Artist >> Digital Painting >> Levi Hopkins, i see all my blog posts...

    For example, in my video category, actually i have 1 post in it, but when i click the category, i see all my blog posts. I just want to see the respective posts of each category.

    Thank you.

  4. Peter_L
    Member
    Posted 1 year ago #

    I've heard about a category.php file, am i in the right direction?

    Yes, look it up. Check your theme's folder for this file. http://codex.wordpress.org/Category_Templates

  5. pwoperART
    Member
    Posted 1 year ago #

    I've already checked and nothing found.

    About creating one, how i do that? Thank you.

  6. Peter_L
    Member
    Posted 1 year ago #

    Do you have an archive.php file? If not, have you altered anything in the loop on the index.php file?

    There are different ways of doing thing in WordPress, depends on the theme.

    Normally, when there is no category.php - or archive.php file, the index.php file takes over. http://codex.wordpress.org/Template_Hierarchy
    But even then, it should still work. So you probably made a setting somewhere or an alteration to the loop.

  7. pwoperART
    Member
    Posted 1 year ago #

    Yes, i have an archive.php file.

    As i remember, i didn't make changes in the index.php

  8. pwoperART
    Member
    Posted 1 year ago #

    <div id="container">
    		<?php if(have_posts()) :
    			if(isset($_GET['order'])){
    				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    				$args = array(
    					'meta_key' => $_GET['order'],
    					'orderby'   => 'meta_value_num',
    					'paged' => $paged,
    					'order' => DESC
    				);
    			}else{
    				$args = array(
    					'paged' => $paged
    				);
    			}
    			query_posts($args);
    			while (have_posts()) : the_post(); ?>
    			<?php get_template_part( 'content', get_post_format() ); ?>
    		<?php endwhile; endif; ?>
    	</div>

    That's the container of the archive.php file, don't know if you can check something wrong on the code. Thanks!

  9. Peter_L
    Member
    Posted 1 year ago #

    I don't really understand what line 3 does. Did you write this code yourself? Probably not.

    Try, just as an experiment, to comment out a part of the code.
    Lines 3 - 16. So put a /* in front of line 3 (before if) and put a */ at the end of line 16, like this query_posts($args); */

    Everything in between will be commented out. Upload the file and see if your categories work. If not, remove the comments /* and */ and reupload the file.

  10. pwoperART
    Member
    Posted 1 year ago #

    OMG it worked ! You're a genius! :D Thank you!

    The theme is chinese, a bit old and no more updated by the author, i got a lot of problems to solve, but this one was impossible for me.

    Thanks for the time you spent helping me, have a good night! :)

  11. Peter_L
    Member
    Posted 1 year ago #

    Hold on. you're not done yet. *sighs*

    What you just removed was how you order the posts on the category page, so now everything shows up in the 'default' ordering mode. It might be fine now but once you start getting a lot of posts that might become a problem. So, think about that. How do you want the posts to order?

    Also, since your theme uses a type of infinite scroll instead of pagination, test thoroughly to make sure everything works. You just removed some things that might break something. I don't know, so test!

  12. pwoperART
    Member
    Posted 1 year ago #

    I was so happy, you broke my heart. :( *joke*

    About the post ordering, i would like to see them in a classic way, the posts that are on the top are the most recents, than we scroll and we have the older posts. I think the categories are already ordered in this way...

    Maybe i need more posts on the same category to check if everything is working fine?

  13. Peter_L
    Member
    Posted 1 year ago #

    Maybe i need more posts on the same category to check if everything is working fine?

    Mmmyes? Looks fine, but you never know. Sorry, no easy answer here.

    Good luck with your site.
    (and you know where to look if you ever wanna change the order of your posts)

Topic Closed

This topic has been closed to new replies.

About this Topic