Function – Agency_post_image

Community Forums Forums General Discussion Function – Agency_post_image

This topic is: resolved

This topic contains 18 replies, has 2 voices, and was last updated by  genevishgraphics 8 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #73937

    genevishgraphics
    Participant
    Post count: 52

    Using Runway community theme – It is utilizing this code in functions.php to display thumbs of the posts on the front page (home page), however I am finding that it is also displaying this way on a page using wordpress’s built in gallery. So now I have a duplicate large image at the top of the page, and below that is the page title and the gallery. Any suggestions on how to tweak this so it is only going to apply to the home page and not any other pages? Thanks

    /** Add Post image above post title, single posts only */
    add_action( ‘genesis_before_post’, ‘agency_post_image’ );
    function agency_post_image() {
    if ( is_front_page() ) return;
    if ( $image = genesis_get_image( ‘format=url&size=post-image’ ) ) {
    printf( ‘%s‘, get_permalink(), $image, the_title_attribute( ‘echo=0′ ) );
    }
    }

    http://www.greenqueen.com.hk/gq-press/
    #73998

    nutsandbolts
    Moderator
    Post count: 3113

    Did you get this resolved? I’m not seeing the gallery on individual posts – just the large featured image.


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #73999

    genevishgraphics
    Participant
    Post count: 52

    Its just on the press page, a large image above the title of the page, then the gallery below that.

    #74000

    nutsandbolts
    Moderator
    Post count: 3113

    Okay, I see it now. If you edit that page and switch to the Text editor instead of Visual, can you paste in everything from the editor box?


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74001

    genevishgraphics
    Participant
    Post count: 52

    Sure – I have combed through and dont see the repeat image

    <p>[gallery link="file" ids="7381,2492,2488,2062,2060,2059,2057,1732,1717"]</p>
    <p>&nbsp;</p>
    <h1>As seen on</h1>
    <p><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/logo-veggy.jpg"><img class="alignleft size-full wp-image-2565" alt="Veggy Japan" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/logo-veggy.jpg" width="242" height="111" /></a></p>
    <p><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/playtimes.png"><img class="alignleft size-full wp-image-2564" alt="Playtimes Magazine" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/playtimes.png" width="216" height="69" /></a></p>
    <p><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/scmp.png"><img class="alignleft size-full wp-image-2560" alt="South China Morning Post SCMP" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/scmp.png" width="621" height="58" /></a></p>
    <p><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/sassymama.png"><img class="alignleft size-full wp-image-2559" alt="sassymama" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/sassymama.png" width="492" height="111" /></a><img class="alignleft size-full wp-image-2547" alt="Sassy Hong Kong" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/sassy-hk.png" width="387" height="172" /></p>
    <p><img class="alignleft size-full wp-image-2545" alt="Foodie Magazine" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/foodie-magazine.png" width="252" height="144" /><img class="alignleft size-full wp-image-2550" alt="expatlivingrevamp_logo" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/expatlivingrevamp_logo.jpg" width="520" height="154" /><img class="alignleft size-full wp-image-2574" alt="Hong Kong Tatler Dining" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/tatler-online.png" width="261" height="112" /><img class="alignleft size-full wp-image-2561" alt="Healthy Hong Kong Blog" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/healthyhkblog.png" width="341" height="85" /><br class="Apple-interchange-newline" /><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/the-list.png"><img class="alignleft size-full wp-image-2558" alt="The List Magazine" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/the-list.png" width="387" height="116" /></a></p>
    <p><img class="alignleft size-full wp-image-2557" alt="hk mag asiacity_logo" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/hk-mag-asiacity_logo.png" width="222" height="93" /><a href="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/hkyantoyan.png"><img class="alignleft size-full wp-image-2555" alt="HK Yanto Yan" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/hkyantoyan.png" width="350" height="97" /></a></p>
    <p><img class="alignleft size-full wp-image-2549" alt="Hip Hong Kong " src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/hhklogo.gif" width="125" height="124" /><a href="http://thehkhub.com/featured-posts/green-queens-guide-to-hong-kong/"><img class="alignleft size-full wp-image-2553" alt="thehkhub" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/thehkhub.png" width="181" height="119" /></a><img class="alignleft size-full wp-image-2554" alt="localiiz" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/localiiz.png" width="216" height="83" /><img class="alignleft size-full wp-image-2551" alt="little_steps_logo_all_0" src="http://www.greenqueen.com.hk/wp-content/uploads/2011/10/little_steps_logo_all_0.png" width="642" height="120" /></p>
    #74002

    nutsandbolts
    Moderator
    Post count: 3113

    Okay, so it’s supposed to be showing the gallery and not the large image at the top. I was thinking the opposite.

    If you remove the featured image from the page, does that solve the problem? I’m guessing the page won’t be showing in the homepage grid since it’s a page and not a post, so there shouldn’t be any reason to include a featured image.


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74004

    genevishgraphics
    Participant
    Post count: 52

    Thats just it – there is no featured image attached to the page at all – weird right?

    #74005

    nutsandbolts
    Moderator
    Post count: 3113

    Yeah, that’s definitely weird. The page source clearly shows it with the class “post-photo”. Hmmm….

    The function for the featured image is already using a conditional to work on the homepage only, so that shouldn’t be the problem. If you activate the Genesis Framework instead of Runway, does it still show like that?


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74050

    genevishgraphics
    Participant
    Post count: 52

    I really dont want to switch the theme to genesis since it is a live site :(

    #74059

    nutsandbolts
    Moderator
    Post count: 3113

    Ah, I understand completely! I didn’t realize the site was live.

    Are you using a page template for that page, or just the default?


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74060

    genevishgraphics
    Participant
    Post count: 52

    Nope just plain old regular default – I am sure I am missing something here, or do you think it is a conflict with wp built-in gallery and the theme?

    #74063

    nutsandbolts
    Moderator
    Post count: 3113

    It shouldn’t be… I use the default gallery all the time and I’ve never had this problem.

    Try this – remove the gallery from the page (leave in all the logos at the bottom, and make sure you paste the shortcode for the gallery somewhere so you can put it back). If that takes away the giant image, I would try adding the gallery again from scratch. If it doesn’t, we’ll know it’s nothing to do with the gallery.


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74068

    genevishgraphics
    Participant
    Post count: 52

    Hmmm I took out the gallery shortcode and it is still there. So its not the gallery its the theme. If you look at this page, I have the same issue with the featured image – it is above the title, only this time it really is a featured image, however its a page not a post, and the function is directed towards the front page only, so it shouldnt affect any other pages, right?

    #74069

    nutsandbolts
    Moderator
    Post count: 3113

    Okay, good to know. Can you paste in your entire functions.php?


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

    #74071

    genevishgraphics
    Participant
    Post count: 52

    Seems like is is the code snippet I noted earlier – here is the full thing

    <?php
    // Start the engine
    require_once( get_template_directory() . '/lib/init.php' );
    
    // Child theme (do not remove)
    define( 'CHILD_THEME_NAME', 'Runway Theme' );
    define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/runway/' );
    
    // Add Viewport meta tag for mobile browsers
    add_action( 'genesis_meta', 'sample_viewport_meta_tag' );
    function sample_viewport_meta_tag() {
    	echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
    }
    
    add_filter( 'wpbdp_form_field_html_value', 'my_mailto_filter', 10, 3 );
    function my_mailto_filter( $value, $post_id, $field ) {
    if ( $field->has_validator('email') ) {
    return sprintf('<a href="mailto:%s">%s</a>', $value, $value);
    }
    return $value;
    }
    
    // Add support for custom background
    add_theme_support( 'custom-background' );
    
    // Add support for 3-column footer widgets
    add_theme_support( 'genesis-footer-widgets', 3 );
    
    // Enqueue sticky menu script
    add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' );
    function custom_enqueue_script() {
    wp_enqueue_script( 'sticky-menu', get_stylesheet_directory_uri() . '/js/sticky-menu.js', array( 'jquery' ), '', true );
    }
    
    // Reposition the secondary navigation menu
    remove_action( 'genesis_after_header', 'genesis_do_subnav' );
    add_action( 'genesis_before', 'genesis_do_subnav' );
    
    // Unregister other site layouts
    genesis_unregister_layout( 'content-sidebar-sidebar' );
    genesis_unregister_layout( 'sidebar-sidebar-content' );
    genesis_unregister_layout( 'sidebar-content-sidebar' );
    
    // Customize the post info function
    add_filter( 'genesis_post_info', 'post_info_filter' );
    function post_info_filter($post_info) {
    if ( !is_page() ) {
        $post_info = '[post_date]';
        return $post_info;
    }}
    
    //* Add font awesome
    add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
    
    function prefix_enqueue_awesome() {
    wp_enqueue_style( 'prefix-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css', array(), '3.2.0' );
    }
    
    // Modify the speak your mind text
    add_filter( 'genesis_comment_form_args', 'custom_comment_form_args' );
    function custom_comment_form_args($args) {    
    $args['title_reply'] = 'Leave a Comment';    
    return $args;
    }
    
    function make_mce_awesome( $init ) {
        $init['theme_advanced_text_colors'] = '72bf44,ec0080';
        return $init;
    }
     
    add_filter('tiny_mce_before_init', 'make_mce_awesome');
    
    /** Add Post image above post title, single posts only */
    add_action( 'genesis_before_post', 'agency_post_image' );
    function agency_post_image() {
    if ( is_front_page() ) return;
    if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) {
    printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
    }
    }
    
    // Add News Widget Area
    register_sidebar( array(
    	'id'				=> 'news',
    	'name'			=> __( 'News', 'runway' ),
    	'description'	=> __( 'This is the news section.', 'runway' ),
    ) );
    
    add_action( 'genesis_before', 'runway_news_genesis' );
    	/**
     * Add news widget support for site. If widget not active, don't display
     *
     */
    function runway_news_genesis() {
    			genesis_widget_area( 'news', array(
        'before' => '<div class="news widget-area">',
    		) );
     
    	}
    // Add Slider Widget Area
    genesis_register_sidebar( array(
        'id' => 'home-featured',
        'name' => __( 'Home Featured', 'runway' ),
        'description' => __( 'This is the widget area for the Genesis Responsive Slider.', 'runway' ),
    ) );
    
    /** Custom image sizes */
    add_image_size( 'Grid', 200, 200, TRUE );
    add_image_size( 'Featured-Home', 750, 500, TRUE );
Viewing 15 posts - 1 through 15 (of 19 total)

The topic ‘Function – Agency_post_image’ is closed to new replies.