• 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

Genesis Featured Posts Widget

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 › Internationalization and Translations › Genesis Featured Posts Widget

This topic is: not resolved

Tagged: featured posts, translations, wpml

  • This topic has 2 replies, 3 voices, and was last updated 5 years, 10 months ago by harrygreen.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 29, 2017 at 8:34 am #208463
    mikelbyl
    Member

    I have transitioned a bunch of sites I manage back to the built-in Genesis Featured Posts widget (from an alternative that was not developed and has broken), and in this transition I have noticed that many of the texts in the widgets are not coded in such a way that WPML picks them as string translations. This was kind of surprising, because Genesis otherwise works so brilliantly with WPML, but whatever.

    So in order to use the widgets, I had to go in to the plugins in Genesis and edit the pieces that needed to be translatable strings. Of course this is not ideal, because a Genesis update could blow away my edits.

    So my real question is how do I implement these code changes in a functions.php file or in some other non-destructable manner?

    Code from /genesis/lib/widgets/featured-post-widget.php:

    Original:

    if ( ! empty( $instance['more_from_category'] ) && ! empty( $instance['posts_cat'] ) ) {
    	printf(
    		'<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>',
    		esc_url( get_category_link( $instance['posts_cat'] ) ),
    		esc_attr( get_cat_name( $instance['posts_cat'] ) ),
    		esc_html( $instance['more_from_category_text'] )
    	);
    }
    

    Modified:

    if ( ! empty( $instance['more_from_category'] ) && ! empty( $instance['posts_cat'] ) ) {
    	printf(
    		'<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>',
    		esc_url( get_category_link( $instance['posts_cat'] ) ),
    		esc_attr( get_cat_name( $instance['posts_cat'] ) ),
    		esc_html( __($instance['more_from_category_text']) )
    	);
    }
    

    And

    Original:

    echo $args['before_title'] . '<span class="more-posts-title">' . esc_html( $instance['extra_title'] ) . '</span>' . $args['after_title'];
    

    Modified:
    echo _e( $args['before_title'] . '<span class="more-posts-title">' . esc_html( $instance['extra_title'] ) . '</span>' . $args['after_title']);

    https://events.playgroundpoker.ca/powerweekendjuly2017/
    June 29, 2017 at 9:19 am #208466
    Brad Dalton
    Participant

    You can copy over the widget to your child theme.


    Tutorials for StudioPress Themes & WooCommerce.

    July 16, 2017 at 5:00 am #209169
    harrygreen
    Member

    So, that what I've read here is wrong?

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

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