• Hey all,

    New to WordPress. Don’t know if whet I’m asking for is feasable….but I figured I’d ask.

    So…I have a bunch of posts and they’re all Categorized. So for arguments sake we have 3 cat’s (house, car, boat).

    I want to create a PAGE not a POST but a PAGE and somehow have it run a SQL select statement and take all the stories that had the Categorie BOAT for arguments sake, and list then titles of those stories on the PAGE.

    It doesn’t have to be done with SQL selects..but I have no clue where to start to get this to work.

    Help, thanks

Viewing 15 replies - 1 through 15 (of 16 total)
  • This is relatively easy to do, but the exact coding depends on the theme you are using.

    Basically, you make a custom template, usually starting with either index.php or page.php, and modify it to select your category.

    If you are using a free theme, post a link to your site here and someone may be able to help. If you are using a paid theme, you should contact the theme supplier.

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    Thanks a bunch for the quick response. So I made a template called writing.php. I’m using the ‘Esquire’ theme. I’ll paste the template code here…it’s based on index.php. I don’t think there’s to much to the code but it’s still over my head ??

    Anyhow, if you can just show me what I need to tweak in order to get this page to loop through and grab all the posts by the categorie named ‘stories’ and have them display the post name on the page as links.

    Thanks for any help…much appreciated.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    I have put a template named OneCategory in a pastebin:

    https://pastebin.com/qh0mrTfk

    You can use this template to display the titles from a single category.

    Create a blank Page with the title you wish to show on the page.

    Add a Custom Field named ‘category-to-show’ and give it a value of the category name.

    Set the template to OneCategory.

    Publish the Page.

    View the Page.

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    Works well! Thanks a bunch. I had to adjust my slug to get it to work but once I did all went well. Only problem is the loop seems to iterate twice. Spits out 2 random posts every time if I refresh page. I have 6 labeled with the proper cat name and I get a random 2 every refresh.

    There is nothing in the code to explain that. I do not see that behaviour in my test site. I loaded the Esquire theme and tested it there.

    Please post a link to your site where the problem can be seen.

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    OK….I know what I did and I corrected it but I can’t find a way around it. I had wrapped a set of <div> tags around your code as I wanted to be able to apply a CSS class to the DIV tag and a background to the class, but when I did that it limited it to the two posts. Must have been how I had the DIV’s as I’m back to being able to have all the post’s again but I can’t apply a background to the bulk of them. Only individually. If I apply it to the #posts class, then it stretches across the page. I need to wrap the output at the postbody level….

    You should be able to put the opening div tag between these two lines:

    <?php /* Start the Loop */ ?>
    		   <?php while ( have_posts() ) : the_post(); ?>

    EDIT: Spoke too quickly. Please place the closing div between these two lines:

    <?php endwhile; ?>
    
    	   <?php else : ?>
    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    Thanks.

    Here is my site link.

    Can you help with two things? First is I’d like the post pics you see (should only be two there one under the other) to be side-by-side…3 per row then a new row.

    Secondly, why do the thumbnails appear to be cut off? I thought that DIV box would re-size itself accordingly?

    Thanks for any help.

    Your posts div needs to fit in the right-hand screen area, not extend to the left margin. Then make your posts a fraction of the width of that div and float them left inside of it.

    Your thumbnails are not cropped by the div, they are cropped when you load them into the media library. You can edit an image and re-crop only the thumbnail.

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    I would agree with you, but, when I go into the media section….I can see my thumbnail…and it looks GREAT!!!! But that thumbnail I see, is not what’s rendered on my page.

    I would put up a screen shot but I can’t.

    Here is the code for one of the thumbnails that I grabbed off the screen:

    <img width="150" height="150" title="Swan Song" alt="Robert McCammon" class="attachment-post-thumbnail wp-post-image" src="https://rodneyjamesgalley.com/wp-content/uploads/2012/04/swan1-150x150.jpg">

    As you can see, it is cropped to 150×150.

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    Thanks vtxyzzy, you’ve been awesome help! I got the thumbnail thing figured out. Set featured image is a little convoluted when trying to set a thumb as a featured…but I got it!
    As you can see by the link…I set used css to highlight the only div tags that I floated left…it was the .wp-post-image I messed with to get that result…I have some margin and padding there also…just to show the problem.
    my site
    One div on the far left rises slightly, and I doubt these will fall to second row after 3 or 4 as they’re not really wrapped in a DIV.
    Well….they sem to be in #post…but when I inspect it…it’s off on it’s own over in the corner and I can’t seem to get it to do anything with these other div’s that hold the thumbnails….sorry for my crappy explanation.

    Now you have the posts div inside the sidebar! Put a border around the divs temporarily so you can see where they fall, and/or use an editor that lets you see how the divs are nested. Look at some other sites to see how they do i

    Thread Starter l0ad3dr3v0lv3r

    (@l0ad3dr3v0lv3r)

    I understand how to move the DIV….as you can see now…it’s over on the right side….but it’s static and I can’t set it to absolute as it messes everything up. I can’t seem to do much,,,as soon as I do, everything in the sidebar starts shifting around. I guess I just don’t get nested DIVS

    I’m sorry, your layout is so different from anything I have experienced that I cannot see how to fix it.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘List of Titles on PAGE’ is closed to new replies.