WordPress.org

Forums

Need Help With Some Customization (53 posts)

  1. teckn1caLity
    Member
    Posted 2 years ago #

    http://thesidetracked.com

    Hello to all that felt my thread title was interesting :D. I need some help from someone or multiple people who can help me. If you look at this image, that's basically what I want to accomplish.

    http://i52.tinypic.com/9a6c80.jpg

    I want to have 3 thumbnails with the title for a little featured content area of the sort. If anyone could point me into the right direction that would be fantastic.

    I normally try to do most customizing on my own to gain knowledge but I can't seem to find where to start with this.

    Regards,

    Someone In Desperate Need

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Not sure how much help I can give without access to the theme code, but in general, I think you need to do this:

    • Create a special category (or custom post) to hold the images
    • Create a separate loop before your main loop
    • In this separate loop, retrieve the post with the images.
    • Start a wrapper div to hold 3 individual divs for the images.
    • Put one image inside each of the individual divs
    • Close the wrapper div

    Then, use CSS to size and float the individual divs so they line up.

  3. teckn1caLity
    Member
    Posted 2 years ago #

    I really appreciate the suggestion. Though, I don't really have an extensive knowledge of wordpress I can do customization if there was something I can work with. But starting from scratch is something I don't believe I will be able to accomplish.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

  5. teckn1caLity
    Member
    Posted 2 years ago #

    I understand loops slightly even after reading that. But, where would I go to start, I still seem kind of lost.

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    I'd suggest using get_posts() for the secondary Loop (the one that will output the three featured posts/boxes). Just remember that get_posts can take all of the same parameters as query_posts - so it's a lot more powerful than it might look at first glance.

    As vtxyzzy said, you also need something that will "identify" the posts in your new custom query - either a specific category, tag or a custom field. So start by thinking on that and figuring out how to construct the arguments for get_posts first.

  7. teckn1caLity
    Member
    Posted 2 years ago #

    Im at the get_posts() codex page right now, how would I go about adding a specific category and the last 3 posts. IE.

    <?php get_posts( cat_ID, show=3 $args ); ?>

    Obviously that's wrong but I don't know how to insert those 2.

  8. vtxyzzy
    Member
    Posted 2 years ago #

    Here is some (UNTESTED) sample code:

    <?php
    
    $category = 22;  // The id of the special category
    $args = array(
       'cat' => $category,
       'posts_per_page' => 3,
       'caller_get_posts' => 1
    );
    $posts = get_posts($args);
    if ($posts) { ?>
       <div class="wrap3">
       <?php foreach ($posts as $post) {
          ++$post_count;
          setup_postdata($post); ?>
          <div class="oneof3">
             <?php echo get_the_post_thumbnail($post->ID); ?>
             <p><?php the_title(); ?></p>
          </div>
       <?php }
       for ($i = $post_count + 1;$i < 4; ++$i) { ?>
          <div class="oneof3">
             &nbsp;
          </div>
       <?php } ?>
       </div>
    <?php }
    wp_reset_query();
    ?>
  9. teckn1caLity
    Member
    Posted 2 years ago #

    I tried putting that in to see if I can mess with it doing some customization and it seems nothing comes up.

  10. vtxyzzy
    Member
    Posted 2 years ago #

    I have done all that I can do without access to your code.

  11. teckn1caLity
    Member
    Posted 2 years ago #

    I can give code, what code would you like?

  12. vtxyzzy
    Member
    Posted 2 years ago #

    The code that you are trying to modify to show the images. The code that creates the page you showed in your first link.

    Put it in a pastebin and post a link here.

  13. teckn1caLity
    Member
    Posted 2 years ago #

    I can give you my main index code, would that suffice?

  14. vtxyzzy
    Member
    Posted 2 years ago #

    I can't tell until I see the code.

  15. teckn1caLity
    Member
    Posted 2 years ago #

    I don't have any code for what I'm trying to do. That's why im here. To find some help in developing what i need done in that picture I painted above.

  16. vtxyzzy
    Member
    Posted 2 years ago #

    As I said above:

    The code that you are trying to modify to show the images. The code that creates the page you showed in your first link.

    Put it in a pastebin and post a link here.

  17. teckn1caLity
    Member
    Posted 2 years ago #

    The code to show the images is non-existent, hence why I'm here.
    Here is the code that creates the paged I showed you in my first link.

    http://pastebin.com/CDnNeqfa

  18. vtxyzzy
    Member
    Posted 2 years ago #

    OK - a little progress.

    Now, you need to decide how you will store the images.

    If you create a new category to hold the images, you will need a plugin to exclude that category from other parts of your site. This seems like an easy way to go.

    Or, you could create a Custom Post Type to hold the images.

    Which do you want to do?

  19. teckn1caLity
    Member
    Posted 2 years ago #

    I wanted to use something that would pull an image from the post. I could do custom post type but pulling and thumbnailing to a specific size would be more suitable.

  20. vtxyzzy
    Member
    Posted 2 years ago #

    A custom post type just stores the images. It does not affect how you show the image. The code does not care if it is a regular post type or a custom post type. The advantage of a custom post type is that it will not show up on any of your other pages.

    If you use a category, you will need a plugin to hide the category on other pages. If you use a custom post type, you will not need a plugin.

    Putting the images in a post, either regular or custom, is just a convenient way of storing the images for easy retrieval. It allows you to change images just by creating a new post and uploading an image in it.

    Before I can create the code to retrieve the images, I need you to decide how you want to store them. If by category, you need to create the category and give me the category ID. If by custom post type, you need to create the custom post type and give me the post type 'slug'.

  21. teckn1caLity
    Member
    Posted 2 years ago #

    I think I will go with the category. The category ID I want to show up is 108. Thanks for the help thus far man.

  22. teckn1caLity
    Member
    Posted 2 years ago #

    I was searching around and I found something similar to what I want, at the top of http://www.filmdrunk.com.

  23. teckn1caLity
    Member
    Posted 2 years ago #

    VTX DON'T LEAVE!

  24. vtxyzzy
    Member
    Posted 2 years ago #

    Didn't go anywhere. It took a while to do the coding!!

    Here is a link to the patched code.

    Be sure to change the Category ID in the code to your own special category.

    To use the code, create a post and assign it to the special category. The title of the post will be shown beneath the image. Use the 'Featured Image' selection in the right margin to select an image and assign it as the featured image.

    The most recent 3 posts in the special category will be shown.

  25. teckn1caLity
    Member
    Posted 2 years ago #

    I don't see a "Featured Image" section, do I add it as a Custom Field?

  26. teckn1caLity
    Member
    Posted 2 years ago #

    vtx? Any suggestions? I wanna try to get this working before the weekend if at all possible.

  27. vtxyzzy
    Member
    Posted 2 years ago #

    Your theme may not support it. Are you running WP 3.x? If so, add these lines to your functions.php, but be careful to use php opening and closing tags if necessary:

    add_theme_support('post-thumbnails');
    set_post_thumbnail_size( 50, 50 );

    It is getting late here - I will have to continue tomorrow.

  28. teckn1caLity
    Member
    Posted 2 years ago #

    I don't have a functions.php file with this specific theme. Yes, I'm using 3.x.

  29. vtxyzzy
    Member
    Posted 2 years ago #

    Then create one with this in it:

    <?php
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size( 50, 50 );
    ?>
  30. teckn1caLity
    Member
    Posted 2 years ago #

    I'm trying to get the pass to the hosting from my friend to add the functions.php file. Is there an alternative route I could take instead of waiting?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.