Forums

[resolved] How to assign all posts with an specific category to a page? (36 posts)

  1. sarah.kho
    Member
    Posted 1 year ago #

    Hi,
    Can you please let me know how I can show all posts with "Immune" category under a page? I created the page but do not know how to show categories there.

    Thanks.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  3. takingweb
    Member
    Posted 1 year ago #

    esmi, the code posted on the codex page doesn't work...it give me an error:

    Fatal error: Call to a member function get() on a non-object in /home/marcon25/takingweb.com/mcouture/wp-includes/query.php on line 27

    maybe i'm wrong but this is exactly my page code:

    Replace by mod with pastebin.
    http://wordpress.pastebin.com/JfwmQhFT

    ..and is the same on codex...

  4. takingweb
    Member
    Posted 1 year ago #

    i've found the mistake :(
    it run a conflict with the plugin The Events Calendar

    :(

  5. sarah.kho
    Member
    Posted 1 year ago #

    Hi, Can you give me more hint on how to do this please?

  6. sarah.kho
    Member
    Posted 1 year ago #

    Hi,

    I finally managed to make it work partially.

    A big problem is that my widgets which should be shown in the left side of the page are now shown after the posts.

    Any comment on how to fix it?

    Thanks.

  7. sarah.kho
    Member
    Posted 1 year ago #

    And another problem, the content of the posts are not using the default styling and they are not aligned with the whole site.

  8. alchymyth
    The Sweeper
    Posted 1 year ago #

    http://codex.wordpress.org/Pages#A_Page_of_Posts is only an example of how to do it (for the kubrick default theme) - not a 'copy/paste' code.

    of course you need to use the html structure of your own theme and just take the principle idea from the above link.

  9. Mark / t31os
    Moderator
    Posted 1 year ago #

    However if you're not code savy, take the code from your theme's index.php (or whichever file normally deals with displaying posts, for example you may have a home.php), copy the code from the file, paste it into the box here.

    http://wordpress.pastebin.com/

    Submit.

    Then copy the address(url) provided by the pastebin after submitting the code and post it in your reply here, and i'll help you with the procedure.

  10. sarah.kho
    Member
    Posted 1 year ago #

    Hi,
    Isn't any plugin to perform this task easily?

    And what is the best procedure to know what changes I should apply on this code to work properly on my theme? (Blocks2)
    Thanks

  11. Mark / t31os
    Moderator
    Posted 1 year ago #

    Plugin, maybe this one?
    http://wordpress.org/extend/plugins/list-category-posts/

    Else, as i said before, i'll help you make the adjustments if you provide the necessary code.

    :)

  12. sarah.kho
    Member
    Posted 1 year ago #

    Thank you very much for the offer.
    I was playing with the following codes to see whether I can craft somethig or not. And so far, I was not able to make it properly

    Here is the single post page for the theme I use:

    [code replaced by pastebin by t31os]
    http://wordpress.pastebin.com/des0GeUn

    And here is the archive code for the theme:

    [code replaced by pastebin by t31os]
    http://wordpress.pastebin.com/mC86cpGi

    I was able to make the post appear a bit styled but the widgets were not showing correctly.

    Any help is very welcome.

  13. sarah.kho
    Member
    Posted 1 year ago #

    Hi,

    I posted the code into the pastebin and there are the URLs

  14. Mark / t31os
    Moderator
    Posted 1 year ago #

    Have done that for you already.. ;)

    .. the problem is not with the code not being in a pastebin, but the amount of scrolling required when lots of code gets posted (terrible for people like me on small screens).

    I'll take a look now and post back shortly.

  15. Mark / t31os
    Moderator
    Posted 1 year ago #

    http://wordpress.pastebin.com/qdz402cZ

    Save that into a new file, call it what you like, but give it a PHP extension and don't use one of existing names, use something unique like pageofposts.php, and place it into your current theme's folder.

    Next open up the page you want to show category posts on in your administration section, attach the page of posts template (page template dropdown to the right), add a custom field naming it category, all lowercase, then enter the name of the category to pull posts as the custom field value.

    Save / Update the page.

    View the page.

    Does that look about right? Or need a little tweaking?

  16. sarah.kho
    Member
    Posted 1 year ago #

    Hi,
    Thank you very much.

    Everything is ok but none of the images are shown in the posts :O.

    If I use the following content which I made by mixing the orginal pageofposts, my archive file and the single post photos are shown OK but the widgets are shown after the content and not in the left side.

    here is my version of the file:

    http://wordpress.pastebin.com/jkgZE9sh

    Can you please take a look help me out.

  17. Mark / t31os
    Moderator
    Posted 1 year ago #

    I'm guessing at this point, because i don't have your theme infront of me, but try moving this piece of code..

    // ignore me
    						<div class="column-left">
    							<?php get_sidebar(); ?>
    						</div>

    NOTE: Ignore the "ignore me" line above, work-around for a forum bug when posting coded that is indented/tabbed on the first line.

    Above this line near the top..

    <div class="content">

    So it looks something like this..

    <div class="column-left"><?php get_sidebar(); ?></div>
    <div class="content">

    Beyond that, i ideally need to see a webpage where you're running this theme and code, else i'm guessing how the elements should be placed.

  18. sarah.kho
    Member
    Posted 1 year ago #

    Thanks,

    I applied your changes and now the content appears after the widgets. I will play with the code a bit and then come back to you if I was not able to resolve it myself.

    The left side column width is as big as the content should be and is occupying the content column instead of being in the right side.

    Thank you for helping me out.

  19. Mark / t31os
    Moderator
    Posted 1 year ago #

    Forget the need to see a webpage, i downloaded the theme, the sidebar is included in the footer already, you shouldn't need to include it unless you've modified the theme to change this behaviour.

    Would that be correct, have you been modifying the theme? (not that it's a problem).

    EDIT: Just caught your response, ok sounds good, let me know if you get stuck... ;)

  20. sarah.kho
    Member
    Posted 1 year ago #

    Wow, It is working now, Thanks.

    Now I just need to make sexyBookmark appear after the content and I will be done. Right now the sexy widget does not appear at all. I think I will need to add some source code into the pageOfPosts template file.

    Thanks again.

  21. Mark / t31os
    Moderator
    Posted 1 year ago #

    The code you need to add is covered here.. ;)

    http://wordpress.org/extend/plugins/sexybookmarks/installation/

    Assuming that is the plugin you're referring to.. :)

  22. sarah.kho
    Member
    Posted 1 year ago #

    Yes, that is the plugin, thanks.

    I have one minor problem with the template (before adding the sexybookmarks), There is a empty space between the content and the right side column, the space (gap) is about as big as the right column itself.

    any hint on this is very appreciated.

    Thanks,

  23. Mark / t31os
    Moderator
    Posted 1 year ago #

    Can you link to a page with the problem, i can remove the link afterwards if you'd prefer not to have the link posted here.

  24. sarah.kho
    Member
    Posted 1 year ago #

    Hi,

    Sorry for replying late. I found the problem. It was due to some unwanted div tags.

    I removed

    </div><!-- /contenitore -->
    
    		</div>
    	</div>

    from the end and now it is ok. However I am looking to learn how to add the tags in the end of each post. I will post how it can be done when I findout.

    Thanks for the help.

  25. Mark / t31os
    Moderator
    Posted 1 year ago #

    Hi Sarah,

    Good work getting the template all working correctly. In regards to showing tags under posts, if you're referring to post tags, you may simply need to add something along these lines....

    <p><?php the_tags('Tags:', ', '); ?></p>

    http://codex.wordpress.org/Function_Reference/the_tags

    Let me know if you need further help... :)

  26. takingweb
    Member
    Posted 1 year ago #

    @alchymyth: the code i've posted is MY custom code..not only copy&paste -_-

  27. Jimos
    Member
    Posted 1 year ago #

    I think that there is an easier way to do that. On the page's title type <a href="index.php?cat=5">Page's Title</a> and replace the number 5 with the category's ID. This will redirect you to the category where all your posts are written inthere. This way does the trick for me but then Page's name is showed not in the right place in template...

  28. alchymyth
    The Sweeper
    Posted 1 year ago #

    @takingweb
    no problem - my remark was aimed at @sarah.kho;
    your problem seemed long resolved; and sarah had just hijacked your thread ;-)

    i will try to be more precise in my responses on multi-user threads in the future :-(

  29. Mark / t31os
    Moderator
    Posted 1 year ago #

    Actually Sarah started this thread alchymyth, just to point that out... ;)

  30. Jimos
    Member
    Posted 1 year ago #

    please help me! i am desperate!

Topic Closed

This topic has been closed to new replies.

About this Topic