• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

PHP Help w/Code

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › PHP Help w/Code

This topic is: resolved

Tagged: code, Mocha, recent posts

  • This topic has 5 replies, 2 voices, and was last updated 9 years, 2 months ago by Brad Dalton.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • November 25, 2013 at 6:55 am #75494
    liannef
    Member

    How do I display thumbnails in the following code?

    <?php
    /*
    Template Name: Recent Post
    */
    ?>
    <?php
     get_header();
    ?>
    
    Thank you for visiting the <strong>Archives</strong>!! I have listed the 200 most recent posts here, there are over 2,000 posts to comb through so take your time, sit a spell, take a load off! Want to know what my very first post was? It was on April 15, 2006 about my obsession with <a href="http://themakeupgirl.net/lip-balm/obession-lip-balm/"><strong>Lip Balm.</strong></a> If there is something specific you are looking for, I have the most <strong>Popular Categories</strong> in a drop down set up on the top navigation. You can also use the search box at the top right of the page to search by keyword. Any questions? Just email me <a href="mailto:[email protected]"><strong>[email protected]</strong></a>
    <ul>
    <?php
            $args = array( 'numberposts' => '200' );
        $recent_posts = wp_get_recent_posts( $args );
        foreach( $recent_posts as $recent ){
            echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'" >' .   $recent["post_title"].'</a> </li> ';
        }
    ?>
    </ul>
    
    <?php
     get_sidebar();
     get_footer();
    ?>
    http://www.themakeupgirl.net
    November 25, 2013 at 8:50 am #75512
    Brad Dalton
    Participant

    Why not simply use the blog page template and set it to display 200 posts with the featured image?

    Or use a widget in a template with the Genesis Featured posts widget?


    Get Help – Book Consultation.

    November 25, 2013 at 9:30 am #75515
    liannef
    Member

    Hi There! I figured that out, and I have it set with the blog page template BUT I don't know how to add an intro paragraph at the top without trampling all over the breadcrumbs. I actually used your code at the suggestion of another member in my functions php to set up a widget that would appear before posts but now the breadcrumbs are below it

    http://www.themakeupgirl.net/archives

    November 25, 2013 at 10:05 am #75522
    Brad Dalton
    Participant
    <?php
    /**
     *
     * Template Name: Custom Blog
     * This file handles blog post listings within a page.
     *
     * @author Jen Baumann
     * @link http://dreamwhisperdesigns.com/?p=1011
     * @package Genesis
     */
    
    add_action('genesis_loop', 'genesis_standard_loop', 8);
    
    //* Remove breadcrumbs
    remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    
    genesis();
    

    Source http://dreamwhisperdesigns.com/genesis-tutorials/add-content-genesis-blog-page-template/

    Then you can use some of these snippets in the custom blog page template to customize your page
    http://my.studiopress.com/snippets/


    Get Help – Book Consultation.

    November 25, 2013 at 2:48 pm #75569
    liannef
    Member

    Thank you! Do I add this to my functions.php or is this in place of the other code I added earlier?

    This is what I have currently

    /** Register Before Posts widget area On Blog Page Only**/
    
    genesis_register_sidebar( array(
    'id' => 'before-blog',
    'name' => __( 'Before Blog Widget', 'wpsites' ),
    'description' =>  __( 'This is the before post widget area on the blog page only.', 'wpsites' ),
    ) );
    
    /**
    * @author Brad Dalton - WP Sites
    * @link http://wp.me/p1lTu0-9Jr
    */
      
    /** Before Posts On Blog Page Only*/
    
    add_action( 'genesis_before_loop', 'wpsites_before_blog_widget', 9 );
    function wpsites_before_blog_widget() {
    if ( is_page( '22714' ) ) {
    echo '<div class="before-blog">';
    	dynamic_sidebar( 'before-blog' );
    	echo '</div><!-- end .before-blog -->';
    
    	}
    
    }
    November 25, 2013 at 5:31 pm #75598
    Brad Dalton
    Participant

    To a new page template named page_blog.php


    Get Help – Book Consultation.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble