• I am looking for either a plugin or code solution which will addition of opening any post in a new window/tab while maintaining the default action of opening pages in the same window/tab. Please provide any suggestions on this. Thanks in advance for your assistance!

    • This topic was modified 3 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    The solution depends on what code is used to generate the links to start with. This is often theme dependent. Where your theme outputs links, conditional code could add target="_blank" attribute to the anchor tag. For example:

    global $post;
    the_title( sprintf( '<h2 class="entry-title default-max-width"><a href="%s" %s >', esc_url( get_permalink() ), 'post'==$post->post_type?'target="_blank"':''), '</a></h2>' );
    Thread Starter wowcroftynm

    (@wowcroftynm)

    I will give this a try, and keep you posted. Thank you much!

    Thread Starter wowcroftynm

    (@wowcroftynm)

    Hello,

    I am unable to find the specific theme file in which these links exist. I am running the Elite Business theme. Might you have any suggestions for which file to view and modify? Thanks for your assistance!

    Regards,

    Matthew

    Moderator bcworkz

    (@bcworkz)

    Finding the right file can be tricky. Depending on which links you wish to change, there could be a number of files involved. Try using the Template Debugger plugin to help you identify template files.

    If you still have trouble, try asking in your theme’s dedicated support forum. They’ll know better than I would.
    https://fireflythemes.com/support/

    BTW, you shouldn’t directly alter theme files. Instead create a child theme and copy the files you want to change over to the child and edit those. This way theme updates will not overwrite your custom work.
    https://developer.www.ads-software.com/themes/advanced-topics/child-themes/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Open Specific Post Category in New Window/Tab’ is closed to new replies.