WordPress.org

Ready to get started?Download WordPress

Forums

Add image section to my website. (25 posts)

  1. TheSweede
    Member
    Posted 3 years ago #

    Here I go again with wuestions lol.

    So this was one of thsoe things that I thought would be pretty damn easy to do. but apparently not.

    http://www.LetsKillSomeTime.com

    On the top of the main page, under the header I want to add text/box that says "Image Section" , That I know how to do, Just add a menu.

    But when Someone click on that, I want them to be taken to a page which looks like that main page with the same ammounts of posts per page etc but this time its only images. So The main pages has 8 new videos per day. And when you click on "images section" you go to a page with 8 new images per day.

    How do I do this? I have tried, and looked around but no luck. I thought it was going to be super easy. But no, and I have no idea why.

    Take care

  2. TheSweede
    Member
    Posted 3 years ago #

    still havent figured it out lol.

  3. esmi
    Forum Moderator
    Posted 3 years ago #

  4. TheSweede
    Member
    Posted 3 years ago #

    Thank you. Will read

  5. TheSweede
    Member
    Posted 3 years ago #

    So, I first create a .php file (through wordpad?) named "Snarfer" (for now) and inside that file I add the code.

    Then I create another .php named "pageofposts.php" with that code inside it and save it.

    Then I add both of those files inside my current theme folder through a ftp program? Thats the first step? =)

    Or do I just add the pageofposts code below the sparfer coding? in that snarfer .php

    and then upload the snarfer.php through my proxy with both of the codes into my current theme folder

    and then create a page in wordpress, not adding any text but just a title and then int he "selct template" I select "Snarfer" and press publish, and then I add posts to That template?

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    I first create a .php file (through wordpad?

    No! Only use a plain text editor such as NotePad.

    Then I add both of those files inside my current theme folder through a ftp program? Thats the first step?

    Correct.

    then create a page in wordpress, not adding any text but just a title and then int he "selct template" I select "Snarfer" and press publish

    Correct.

    then create a page in wordpress, not adding any text but just a title and then int he "selct template" I select "Snarfer" and press publish

    No. Select Page of Posts as the template. The code will then do all of the work. You don't add anything else.

  7. TheSweede
    Member
    Posted 3 years ago #

    Ok, lets do it again it since I added both of the codes in one .php and using wordpad.

    I'II be back lol.

  8. TheSweede
    Member
    Posted 3 years ago #

    I have done as you said now. And added the page into the "main menu" or whatever its called so I have it under the mean header. But clicking on it it has added a bunch of stuff automatically. How to I remove that and start adding posts with images in them?

    http://www.LetsKillSomeTime.com "photos" under the mean header

    http://www.youtube.com/watch?v=5s7ReQmlMxw

    that dude seems to be adding posts into a category and then having them show up where he wants it..

  9. esmi
    Forum Moderator
    Posted 3 years ago #

    clicking on it it has added a bunch of stuff automatically.

    Yes - that's being created by the code that you added as part of the page of posts.

    How to I remove that and start adding posts with images in them?

    You cannot "add" posts to this kind of Page ad hoc. The Page displays posts based on specific criteria as pre-defined in the code.

    that dude seems to be adding posts into a category and then having them show up where he wants it..

    Correct.

  10. TheSweede
    Member
    Posted 3 years ago #

    Well my whole point of this was to being able to add images to a "photos" section of the site..
    Since I mentioned that in the first posts I thought that was what you were helping me with..

    I guess I want to do what hes doing I think?

  11. esmi
    Forum Moderator
    Posted 3 years ago #

    Create a category called Photos. File posts under the Photos category as required. Amend the PageofPosts template to pull from the Photos category. Job done.

  12. TheSweede
    Member
    Posted 3 years ago #

    "Amend the PageofPosts template to pull from the Photos category"

    would you mind helping me with that?

  13. TheSweede
    Member
    Posted 3 years ago #

    "Create a category called Photos. File posts under the Photos category as required. "

    photo automatically gets posted on front page atm at least, which is the main issue all along

  14. esmi
    Forum Moderator
    Posted 3 years ago #

    http://pastebin.com/ywK4E79E
    An amended version of the code from http://codex.wordpress.org/Pages#A_Page_of_Posts that simply displays all posts from the Photos category - including sticky posts.

  15. TheSweede
    Member
    Posted 3 years ago #

    http://www.letskillsometime.com

    as you can see that seems to be the case now, Now its just the problem of removing the photo from the main page, and still having it show up when you Click "photos"

    // If I ever in the incredible distant future make some money from this site, I will give you some asmi lol.

  16. esmi
    Forum Moderator
    Posted 3 years ago #

    You now need to add a custom query to the theme's index.php template file to exclude the Photos category. First you need to How do I find an id?">find the id of the Photo category (let's assume it's 23), then create your new custom query:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => '-23', // the id of the Photos category
    	'paged' => $paged
    );
    query_posts($args);
    ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    [etc]
  17. TheSweede
    Member
    Posted 3 years ago #

    so I copy that exactly and change the "23" to "275" which apparently was the photo category id..

    And then open index.php in the template folder that Im using through ftp and add that below everything else?

  18. esmi
    Forum Moderator
    Posted 3 years ago #

    so I copy that exactly and change the "23" to "275" which apparently was the photo category id..

    Yes

    And then open index.php in the template folder that Im using through ftp and add that below everything else?

    No! It must come before the start of the main Loop in that template file.

  19. TheSweede
    Member
    Posted 3 years ago #

    http://i52.tinypic.com/29cuqgl.jpg

    brown line seems to be where the loop starts, so on the green line is ok? after the "}" but befure the "/"

    or ist just above Everything ok?

    I tried that, and when I saved it the php file ended up looking Completly different, wtf

    now it looks like

    http://i56.tinypic.com/o5940l.jpg

    I made a copy before editing though which I added back but still looks like that

    edit* back to normal when I restarted the ftp program

    after I put it where I did the green line the site stops working lol. thank god I made that copy, so I have to wait until you till me where to put the code haha =)

    tried above everything and the site didnt craash but didnt do any difference

    http://i54.tinypic.com/2we9oqp.jpg

  20. TheSweede
    Member
    Posted 3 years ago #

    (too late to edit)
    tried above everything and the site didnt craash but didnt do any anything

    http://i54.tinypic.com/2we9oqp.jpg

  21. TheSweede
    Member
    Posted 3 years ago #

    you left a noob hangi'n :D

  22. esmi
    Forum Moderator
    Posted 3 years ago #

    brown line seems to be where the loop starts

    Yes but looking at that code, there's already a custom query being created higher up that is specifically querying custom post types.

  23. TheSweede
    Member
    Posted 3 years ago #

    And what does that mean? I cant add the line I have to to make the image section work?

  24. esmi
    Forum Moderator
    Posted 3 years ago #

    Right now, yes. That template file (and theme) would need some careful examination before implementing any additional custom queries.

  25. TheSweede
    Member
    Posted 3 years ago #

    alright =(. WordPress should add a "post directly into category" option.
    The fact that its such a pain in the ass (at least for beginners I assume) to just add a new section with posts going there right away is random as hell imo. Should just be a normal option. Do you think wordpress would liten to someoe sending them "tips" lol.

Topic Closed

This topic has been closed to new replies.

About this Topic