How Remove Items From Landing Page – Magazine

Community Forums Forums General Discussion How Remove Items From Landing Page – Magazine

This topic is: resolved

This topic contains 10 replies, has 3 voices, and was last updated by  Bill Murray 1 year, 9 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #20041

    Eric McCarty
    Participant
    Post count: 5

    I need to remove several things from the landing page template.  Using Magazine theme.  Here’s the landing page.  http://www.blueridgeparkwaydaily.com/blog/subscribe/

    I would like to remove breadcrumbs, title, and author info.

    Here’s the code for the page_landing.php . . .

    <?php
    /**
    * This file adds the Landing template to the Magazine Child Theme.
    *
    * @author StudioPress
    * @package Generate
    * @subpackage Customizations
    */

    /*
    Template Name: Landing
    */

    // Add custom body class to the head
    add_filter( ‘body_class’, ‘magazine_add_body_class’ );
    function magazine_add_body_class( $classes ) {
    $classes[] = ‘magazine-landing’;
    return $classes;
    }

    // Remove header, navigation, breadcrumbs, footer widgets, footer
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );
    remove_action( ‘genesis_header’, ‘genesis_header_markup_open’, 5 );
    remove_action( ‘genesis_header’, ‘genesis_do_header’ );
    remove_action( ‘genesis_header’, ‘genesis_header_markup_close’, 15 );
    remove_action( ‘genesis_before’, ‘genesis_do_nav’ );
    remove_action( ‘genesis_after_header’, ‘genesis_do_subnav’ );
    remove_action( ‘genesis_after_header’, ‘genesis_do_breadcrumb’);
    remove_action( ‘genesis_before_footer’, ‘genesis_footer_widget_areas’ );
    remove_action( ‘genesis_footer’, ‘genesis_footer_markup_open’, 5 );
    remove_action( ‘genesis_footer’, ‘genesis_do_footer’ );
    remove_action( ‘genesis_footer’, ‘genesis_footer_markup_close’, 15 );

    genesis();

    #20158

    Eric McCarty
    Participant
    Post count: 5

    Title should say “How To Remove Items From Landing Page – Magazine

    #20171

    Joseph Lee
    Participant
    Post count: 140

    Eric, download the AGENTPRESS theme. It has a template in there for a landing page that deletes all the things you are trying to delete. Just copy the lines of code. I think they will be easy to pick out because they are practically named (as always).

    #20691

    Eric McCarty
    Participant
    Post count: 5

    Thanks Joseph,

    Does anyone happen to have the landing page code?  I’ll pay for the AgentPress theme if I have to, but since I’m not using that theme, would rather not if possible.

    #20709

    Bill Murray
    Participant
    Post count: 575

    The landing page code for AgentPress is essentially identical to what you have, so it won’t get you closer to your goal.

    I believe your breadcrumbs aren’t being removed because you have a typo in your landing page template. The correct remove_action is:

    remove_action( ‘genesis_after_header’, ‘genesis_do_breadcrumbs’);

    Note you are missing an ‘s’ on breadcrumbs.

    From memory, this ought to remove the title:

    remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);

    The author info doesn’t appear on the Magazine landing page template, so it’s already been removed.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #20715

    Eric McCarty
    Participant
    Post count: 5

    Thanks Bill.  The title remove worked.

    I had tried the “s” on breadcrumbs and it didn’t solve it.  Copied and pasted your code and tried again and it is still showing up.

    The “Author Info” I mentioned is actually “About Author” down at the bottom.  Shows gravatar, name, and user description.

    #20728

    Bill Murray
    Participant
    Post count: 575

    For the breadcrumbs, the code I gave you is correct. However, the remove_action must be targeting the spot (the hook) where the action is taking place. The hook I gave you is based on the default Magazine theme, which you can see works based on the landing page link in my previous post. Did you reposition breadcrumbs by something in your functions.php? or by use of another plugin? If so, you need to change the hook in the remove action to refer to whereever breadcrumbs are presently located. Look for anything in your functions.php that relates to breadcrumbs and if you can’t figure out the name of the hook, post the relevant code here.

    For the author box, sorry. I didn’t scroll down the whole page. That box is triggered by your author settings, which are not configured to display the author box in the my demo link – hence it didn’t display.

    Try this to remove the author box:

    remove_action( ‘genesis_after_post’, ‘genesis_do_author_box_single’ );


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #21174

    Eric McCarty
    Participant
    Post count: 5

    Thanks Bill!

    I can’t find anything in functions.php regarding breadcrumbs. Pasting the code I have below. And as far as plugins, here is what I have activated: Contact Form 7, Contact Form DB, Genesis Latest Tweets Widget, Genesis Responsive Slider, Jetpack, Simple:Press, WordPress SEO, WP Super Popup. Several more installed, but not activated.

    Author box removal with your code was unsuccessful as well.

    Obviously, I need to learn some php. Recommendations on resources to do this are appreciated.

    <?php
    /** Start the engine */
    require_once( get_template_directory() . '/lib/init.php' );

    /** Child theme (do not remove) */
    define( 'CHILD_THEME_NAME', 'Magazine Theme' );
    define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/magazine&#039; );

    /** Add Viewport meta tag for mobile browsers */
    add_action( 'genesis_meta', 'magazine_add_viewport_meta_tag' );
    function magazine_add_viewport_meta_tag() {
    echo '’;
    }

    /** Create additional color style options */
    add_theme_support( ‘genesis-style-selector’, array(
    ‘magazine-blue’ => ‘Blue’,
    ‘magazine-green’ => ‘Green’,
    ‘magazine-orange’ => ‘Orange’,
    ‘magazine-purple’ => ‘Purple’,
    ‘magazine-red’ => ‘Red’,
    ‘magazine-teal’ => ‘Teal’
    ) );

    $content_width = apply_filters( ‘content_width’, 610, 460, 910 );

    /** Add support for structural wraps */
    add_theme_support( ‘genesis-structural-wraps’, array(
    ‘header’,
    ‘nav’,
    ‘subnav’,
    ‘inner’,
    ‘footer-widgets’,
    ‘footer’
    ) );

    ///add author pic and bio

    function get_author_bio ($content=”){
    global $post;

    {

    $post_author_name=get_the_author_meta(“display_name”);
    $post_author_description=get_the_author_meta(“description”);
    $html=”\n”;
    $html.=”By “.$post_author_name.” “.$post_author_description.”\n”;
    $html.=”\n”;
    $html.=”\n”;
    $html.=”\n\n”;

    $content .= $html;
    }

    return $content;
    }
    add_filter(‘the_content’, ‘get_author_bio’);

    /** Add new image sizes */
    add_image_size( ‘home-bottom’, 280, 150, TRUE );
    add_image_size( ‘slider’, 600, 250, TRUE );
    add_image_size( ‘square’, 120, 120, TRUE );
    add_image_size( ‘tabs’, 580, 250, TRUE );

    /** Add support for custom header */
    add_theme_support( ‘genesis-custom-header’, array(
    ‘width’ => 960,
    ‘height’ => 115
    ) );

    /** Add support for custom background */
    add_theme_support( ‘custom-background’ );

    /** Reposition the primary navigation */
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
    add_action( ‘genesis_before’, ‘genesis_do_nav’ );

    /** Add after post ad section */
    add_action( ‘genesis_after_post_content’, ‘magazine_after_post_ad’, 9 );
    function magazine_after_post_ad() {
    if ( is_single() && is_active_sidebar( ‘after-post-ad’ ) ) {
    echo ”;
    dynamic_sidebar( ‘after-post-ad’ );
    echo ‘‘;
    }
    }

    /** Add after content ad section */
    add_action( ‘genesis_before_footer’, ‘magazine_after_content_ad’ );
    function magazine_after_content_ad() {
    if ( is_active_sidebar( ‘after-content-ad’ ) ) {
    echo ”;
    dynamic_sidebar( ‘after-content-ad’ );
    echo ‘‘;
    }
    }

    /** Add support for 3-column footer widgets */
    add_theme_support( ‘genesis-footer-widgets’, 3 );

    /** Register widget areas */
    genesis_register_sidebar( array(
    ‘id’ => ‘home-top’,
    ‘name’ => __( ‘Home Top’, ‘magazine’ ),
    ‘description’ => __( ‘This is the home top section.’, ‘magazine’ ),
    ) );
    genesis_register_sidebar( array(
    ‘id’ => ‘home-left’,
    ‘name’ => __( ‘Home Left’, ‘magazine’ ),
    ‘description’ => __( ‘This is the home left section.’, ‘magazine’ ),
    ) );
    genesis_register_sidebar( array(
    ‘id’ => ‘home-right’,
    ‘name’ => __( ‘Home Right’, ‘magazine’ ),
    ‘description’ => __( ‘This is the home right section.’, ‘magazine’ ),
    ) );
    genesis_register_sidebar( array(
    ‘id’ => ‘home-bottom’,
    ‘name’ => __( ‘Home Bottom’, ‘magazine’ ),
    ‘description’ => __( ‘This is the home bottom section.’, ‘magazine’ ),
    ) );
    genesis_register_sidebar( array(
    ‘id’ => ‘after-post-ad’,
    ‘name’ => __( ‘After Post Ad’, ‘magazine’ ),
    ‘description’ => __( ‘This is the after post ad section.’, ‘magazine’ ),
    ) );
    genesis_register_sidebar( array(
    ‘id’ => ‘after-content-ad’,
    ‘name’ => __( ‘After Content Ad’, ‘magazine’ ),
    ‘description’ => __( ‘This is the after content ad section.’, ‘magazine’ ),
    ) );
    add_filter(‘login_redirect’, ‘plugin_admin_redirect’);
    function plugin_admin_redirect($redirect_to, $url_redirect_to = ”, $user = null) {
    return ‘/forums’;
    }

    #21209

    Bill Murray
    Participant
    Post count: 575

    Sorry for just catching up on this now. It’s harder than it used to be to find a thread that needs a fresh reply from one of the posters.

    1) On the author box: see the line

    add_filter(‘the_content’, ‘get_author_bio’);

    in your functions.php? You added the author box via a filter that tacks it on the end of post/page content, so the remove action I gave you would not work, which you found out. Before playing around with actions, it’s always a good idea to see how things ended up on the page in the 1st place, because if you try to remove them via a hook and that hook is not how they got there in the 1st place, the remove action won’t work. Therefore, for your situation, try putting this in your landing page template:

    remove_filter(‘the_content’, ‘get_author_bio’);

    2) author box cont’d: I don’t think the way you added the author box is part of the default Magazine theme. I think you would have been better served to add the author box by using an action, which would make removing it easier. If the suggestion above doesn’t work for removal, that’s the next step.

    3) For the breadcrumbs, change the remove action to:

    remove_action( ‘genesis_before_loop’, ‘genesis_do_breadcrumbs’ );

    Post back with the results.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #21491

    Eric McCarty
    Participant
    Post count: 5

    Perfect!  Thank you Bill!

    Your responses were detailed and easy to follow.  I applied for a patent a few years ago that would enable PayPal “tips” for helpful forum posts.  I took the site down and quit shoveling money into the patent app.  You would have definitely received a monetary Thanks for the help.

    Eric

    #21494

    Bill Murray
    Participant
    Post count: 575

    Glad it worked, Eric.

    Smart move on stopping shoveling money into patents. I made that mistake myself. The process patents are a great way to make money – if you’re a patent attorney.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.