• 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

Open Read More in a new tab News Pro Theme

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 › Design Tips and Tricks › Open Read More in a new tab News Pro Theme

This topic is: resolved

Tagged: new tab, News Pro, read more

  • This topic has 28 replies, 2 voices, and was last updated 10 years, 10 months ago by Erik D. Slater.
Viewing 20 posts - 1 through 20 (of 29 total)
1 2 →
  • Author
    Posts
  • June 11, 2015 at 8:26 pm #155923
    CDM
    Member

    Hi.. does anyone know where to put the code and what the code looks like? I saw something about opening read more in a new Window but it was marked as "resolved" and the php file was not identified.

    Thanks

    http://hcvadvocate.org/wordpress/
    June 11, 2015 at 9:02 pm #155924
    Erik D. Slater
    Member

    This works:

    add_filter('the_content_more_link', 'eds_the_content_more_link', 10, 2);
    function eds_the_content_more_link($more_link, $more_link_text) {
    	return str_replace('<a ', '<a target="_blank" ', $more_link);
    }

    You can place it in your functions.php file (although really, it ought to go into a plugin for reuse whenever you switch themes).


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 9:28 pm #155926
    CDM
    Member

    Hi Erik.. should this be "read_more_link" since I'm using the expression "read more...."?

    But I'll give it a go while I'm waiting to hear back from you

    CD

    June 11, 2015 at 9:43 pm #155929
    CDM
    Member

    Definitely does not work

    CDM

    June 11, 2015 at 9:48 pm #155930
    Erik D. Slater
    Member

    Nope. Code doesn't work like that, I'm afraid 🙂

    the_content_more_link is the name of the WordPress hook as defined within WordPress Core. The name itself acts as a reference that encapsulates certain functionality. We then use that reference for purposes such as ... well ... your situation here 🙂

    eds_the_content_more_link references the code you need that will fulfill your request. I could have called it reading_more_is_groovy_man ... but I'm just not that silly 🙂

    You can click here to "read more" (pun intended) about this particular topic 🙂


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 9:51 pm #155931
    Erik D. Slater
    Member

    Definitely does not work

    O ...K ... what isn't working? Assuming you pasted it in correctly, are you getting an error message? Did you clear down any caching? What did you do? And what is it doing?


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 9:54 pm #155932
    Erik D. Slater
    Member

    SORRY I gave you the wrong code. My bad. In fact ... wrong discussion entirely!!

    Hang on a sec ...


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 9:58 pm #155933
    CDM
    Member

    Okay.. I'm hanging. I put the code exactly as you sent it into the functions.php of my news pro theme.. I uploaded it and refreshed the text pages.. and NADA, ZILCH, BUBKAS!

    CDM

    June 11, 2015 at 9:59 pm #155934
    Erik D. Slater
    Member

    OK. I stand corrected. That is the correct code ... and I did paste into the right conversation 🙂

    Sorry about that. I just happen to be talking to someone else on Skype about something similar ... and I thought I got my wires crossed there.

    That code should definitely work. I actually tested it before I gave it to you ... honest I did 🙂


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 10:02 pm #155935
    CDM
    Member

    Hmm. well it doesn't.. I could try it again and clear my cache..again I'll let you know

    CD

    June 11, 2015 at 10:08 pm #155936
    CDM
    Member

    Just cleared cache a few times in Chrome. Nope.. The Weekly Special Topic and the Showcase on the Home page still open on the same home page. I want them to open in a new tab

    CD

    June 11, 2015 at 10:09 pm #155937
    Erik D. Slater
    Member

    Something puzzles me about your blog page.

    Under Resources, you have this:

    Hepatitis C Community and Events Attending support groups and events can help you and others live your life to the fullest. In this section, find … More...

    while below that - under Treatment - you have this:

    Welcome to the HCV Advocate's Hepatitis C Treatment Page. This page includes information about the current drugs to treat hepatitis C, … Read more...

    In other words, you have two different ways to define your "read more" link. Are you adding these yourself?


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 10:13 pm #155938
    Erik D. Slater
    Member

    I see the problem now.

    These are coming from the Genesis - Featured Posts widget ... and I have an extra bit if code for that.


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 10:17 pm #155941
    CDM
    Member

    Hi Erik.. Yes.. I am adding the "Read more..." or "More..." myself.. So, I shouldn't be doing this... Okay.. I don't mind sticking with one.. "Read more..." is the one I prefer.. Yes I'm doing this myself, and yes it is a Genesis Featured Posts widget.

    CD

    June 11, 2015 at 10:30 pm #155943
    Erik D. Slater
    Member

    Yeah. I had adapted the code I currently use myself for the solution here. It will work for regular blog posts ... and is designed to work together with <!--more--> ... which you would add inside your post at the appropriately-strategic position of your choosing.

    If you're adding the read more link by hand inside your posts, you would need to use the target="_blank" attribute inside your link, e.g. <a href="blah url" target="_blank">text</a>.

    With the Genesis – Featured Posts widget, anything you enter into that More Text (if applicable): box usually takes priority.

    I'm just testing something out with the widget and will get back to you post haste ...


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 11, 2015 at 11:08 pm #155944
    CDM
    Member

    Hi Erik.. Yes I know how to add the html code .....a href="blah url" target="_blank" text /a but there is no option here to do that. I use that code manually elsewhere tons..

    Anyhoo: I'm exhausted and going to bed.

    I hope you find a workaround...it would be great.

    Thanks muchly

    CD

    June 12, 2015 at 1:19 am #155949
    Erik D. Slater
    Member

    The solution I provided earlier depends on the use of the <!--more--> quicktag ... which works really well, but you probably don't want to trawl through all your posts to add it in.

    Since there is no reliable way to directly intercept the "read more" link from the Genesis - Featured Posts widget, the following code might be the best solution for you here:

    add_filter('excerpt_more', 'eds_excerpt_more', 10, 1);
    function eds_excerpt_more($more) {
    	return '<a class="more-link" href="'.get_permalink().'" target="_blank">ADD YOUR TEXT HERE</a>';
    }

    This replaces the default [...] thingy when displaying posts using the excerpt option. Now, "excerpt" in this case refers to the automatic 55-word excerpt generated by WordPress ... not the manual excerpt feature available to you in your edit post page ... which doesn't add a "read more" link by default.


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 12, 2015 at 11:04 am #155989
    CDM
    Member

    Good morining Erik!

    I pasted the code into my functions.php and my Dreamweaver protested and said there were 2 syntax errors.

    CD

    June 12, 2015 at 11:17 am #155990
    Erik D. Slater
    Member

    I just copied and pasted the code from this thread (just to make sure I didn't paste something erroneous) ... switched the Content Archives setting in Genesis -> Theme Settings to Display post excerpts ... and all appears to be working.

    Since I can't see your screen, can you shed some light on the Dreamweaver protests?


    Erik D. Slater: Digital Platform Consultant • LinkedIn
    June 12, 2015 at 11:49 am #155991
    CDM
    Member

    Hi Erik.... Can you post me where I can send you the file?

    I don't know how to send you the code with the wrong colors and the dreamweaver comments.. Just that they are the wrong colour and I get a syntax error for this line

    function eds_excerpt_more($more) {

    For the next line I get "Dynamically related files cannot be discovered because there is no site definition" but this is just a warning

  • Author
    Posts
Viewing 20 posts - 1 through 20 (of 29 total)
1 2 →
  • The forum ‘Design Tips and Tricks’ 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

© 2026 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