• 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

Safely customizing widgets

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 › Safely customizing widgets

This topic is: resolved

Tagged: customization, excerpts, genesis, questions, responsive, slider, support, widgets

  • This topic has 6 replies, 3 voices, and was last updated 10 years ago by IoPT.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • March 23, 2013 at 3:34 pm #30782
    IoPT
    Member

    Now that I have my Responsive Slider printing excerpts I have two types of panel to put there:

    Full-length posts with [Read more...] click-through.
    News items where the entire post fits in the slider.

    For the second type of post, it doesn't make sense to allow the reader to click through to what is essentially a dead-end path.  There's nothing more to read on the post than was in the slider.  So to fix that, I've modified the Responsive Slider code.  The routine that prints the title now includes the link only if an excerpt exists. This forces me to *always* write an excerpt, but it was better than coding up a new custom setting for the widget. (At least I believe it was but that's part of my question. See below.) I considered tapping into the_title() but didn't see a way to do that within the slider widget without affecting the the_title globally.


    <?php
    if ( $show_title == 1 ) {
    if ( ($show_type != 'full') && (empty($post->post_excerpt) ) ) { ?>
    <h2><?php the_title(); ?></h2>
    <?php
    } else {
    ?>
    <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <?php
    }
    }
    ?>

    Problem is now I'm responsible to go and restore the customizations every time the widget is updated and auto-update breaks the site. So what I'm wondering is:

    A) is it possible to achieve the same behavior using features of the slider I've overlooked?
    B) if not then could I have changed this somewhere that won't be overwritten?

    Thanks!

    March 23, 2013 at 3:46 pm #30786
    Susan
    Moderator

    If I'm understanding your questions correctly, you don't want certain posts which appear in your slider to be clickable, but want others to be?

     

    If you don't want the the reader to click through to a dead-end post, go into the post and edit it. Scroll down to Custom Redirect URI [?], and either type in the URL of your homepage or #.

    March 23, 2013 at 4:07 pm #30787
    cdils
    Participant

    I wouldn't recommend changing the plugin code for the reasons you mentioned.

    I'm thinking you could use a filter to achieve your results, but I'm not 100% what it is... Here's the Genesis Filter Reference: http://my.studiopress.com/docs/filter-reference/ in case that helps. 🙂


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    March 23, 2013 at 4:08 pm #30788
    IoPT
    Member

    Oooh... Cool! Elegant! Wish I'd thought of that. I'll try it out after dinner. The wife is complaining about being a "WordPress Widow" these last couple of days.

    March 23, 2013 at 10:12 pm #30824
    IoPT
    Member

    @Susan, it was a good idea but didn't pan out. The redirect URI always ended up on the post page, not the current page where the excerpt was printed.


    @cdils
    , I got it to work with a filter registered in the functions.php file as follows:


    function IoPT_excerpt_read_more_link($output) {
    global $post;
    if (empty($post->post_content)) {
    return $output;
    }else {
    return $output . '<a href="'. get_permalink($post->ID) . '">Read More...</a>';
    }
    }
    add_filter('the_excerpt', 'IoPT_excerpt_read_more_link');

    I disabled linking the image and title insertion.  Then for any post that I want to feature in the slider, I am required to make an excerpt and to manually include the title wrapped in <h2> tags.  If I don't want to link to the page, I simply leave the page content empty and write only the excerpt.  If I put any content at all in the page, the more link is generated.  Even better, my preference was to link to the top of the page rather than to the more anchor and this accomplished that goal.  Another added bonus is that I can now also include an image at the top of the post since the content is never used in the slider.  Sweet!

    Thanks, everyone for all the help!  And I do mean everyone.  Even though the one idea didn't work out, I know a lot more about all this tonight than I did this morning.

    March 25, 2013 at 8:58 am #31118
    cdils
    Participant

    Yay! Glad you got a solution. It's fun to figure things out. 🙂

    You might have fun perusing code snippets from other Genesis people over on Github. Start with Brian Gardner (https://github.com/bgardner) and then check his follower list to discover other people & snippets.

    Cheers,
    Carrie


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    March 25, 2013 at 9:25 am #31122
    IoPT
    Member

    Oooh... great links.  Thanks!  I will definitely check those out.

     

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 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