• Resolved LezzetLezzet

    (@lezzetliyiz)


    Hello,
    Thanks for the wonderful theme.
    I have a copyright plugin and I disabled the right click on my website so I would like that my categories, posts and pages can be opened in a new tab when clicked on them. How can I solve this issue? In an older forum, a member said that he placed target=”_blank” into index.php and it worked but I don’t know exactly where I can place it.

    Thank you very very much.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hey there LezzetLezzet,

    How are you doing today ??

    Yes generally adding target=”_blank” to links in HTML will open those links in new tab. Since I’m not sure which links you’re referring specifically and where this is placed in the theme that you’re using I can suggest doing this with some jQuery.

    Adding the following to your theme functions.php will open post links and category links in new tab https://screencast.com/t/JIVd4rMr2v:

    function custom_js(){ ?>
    <script type="text/javascript">
    	jQuery( window ).load(function(){
    		jQuery( '.entry-title a, aside.home-feat-cat h4 a').attr('target', '_blank');
    	});
    </script>
    <?php }
    add_action('wp_footer', "custom_js");

    If you had any other links in mind please post link to your site and let me know which ones so I can add those selectors in the code.

    Hope this helps ??

    Best regards,
    Bojan

    Thread Starter LezzetLezzet

    (@lezzetliyiz)

    I did what you said and now nothing (and nothing works!) my entire website is giving this error:

    Parse error: syntax error, unexpected ‘}’ in C:\sitiweb\blog\wp-content\themes\mesocolumn\functions.php on line 434

    Please tell me how I can fix it? Even if I delete the code you wrote me to add.

    This is horrible!

    Hey again,

    You probably placed it outside of the PHP tag, please see screenshot https://screencast.com/t/IW1XB6vgUpN.

    Also are you editing code in Appearance -> Editor? If yes please use any text editor for editing php files, for example Sublime.

    Best regards,
    Bojan

    Thread Starter LezzetLezzet

    (@lezzetliyiz)

    I am sorry but the screenshot doesn’t help at this stage because I have no access to anything anymore. All I have is the error. I can’t even go back on the page. I can’t even access Appearance or the Dashboard. I might have placed it as you said, in the wrong place, after PHP tag and there is no way to fix it now.

    Hey again,

    Sure there is ??

    Simply download the theme again, unzip it, open the folder and find functions.php which is located in the root of the theme.

    Access your site files (from the URL I’m assuming your hosting it locally, if not access it via FTP or cPanel) and replace the functions.php with the one you copied from the fresh copy of the theme.

    Sometimes when trying to revert changes using Appearance -> Editor these things can happen, you should consider using a text editor.

    Hope this helps ??

    Best regards,
    Bojan

    Thread Starter LezzetLezzet

    (@lezzetliyiz)

    Ok, it works now… Thank you very much and sorry for my panic. :’)

    Hey again,

    No problem at all ?? These things happen often and if this happened to you for the first time I can totally understand how you felt.

    Glad I could help and have a nice day!

    Cheers,
    Bojan

    Thread Starter LezzetLezzet

    (@lezzetliyiz)

    Your code works well as well. Thank you very much and I apologize again.

    Thread Starter LezzetLezzet

    (@lezzetliyiz)

    Thanks for your understanding. Have a nice day.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Opening the posts and pages in a new tab’ is closed to new replies.