{"id":45983,"date":"2015-04-06T06:55:36","date_gmt":"2015-04-06T10:55:36","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=45983"},"modified":"2017-08-07T06:43:54","modified_gmt":"2017-08-07T10:43:54","slug":"wordpress-how-to-make-read-more-links-of-post_grid-shortcode-open-in-new-tab","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-how-to-make-read-more-links-of-post_grid-shortcode-open-in-new-tab.html","title":{"rendered":"WordPress Cherry 3.x. How to make read more links of &#8220;post_grid&#8221; shortcode open in new tab"},"content":{"rendered":"<p>\r\n<p>This tutorial shows how to edit <strong>posts_grid<\/strong> shortcode so that <strong>Read More<\/strong> links and <strong>titles of posts<\/strong> opened in new tab.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=GP7SXR5L1vo?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to make read more links of &#8220;post_grid&#8221; shortcode open in new tab<\/a><\/p>\r\n<p>In order to change shortcode behavior, you will need to edit the shortcode source code in the child theme, i.e. in the <strong>wp-content\/themes\/themeXXXXX\/includes<\/strong> directory on server:<\/p>\r\n<ol>\r\n<li>\r\n<p>Open the <strong>wp-content\/themes\/themeXXXXX\/includes<\/strong> directory and check if there&#8217;s already <strong>shortcodes\/posts-grid.php<\/strong> file on server.\r\n\t<\/p>\r\n<\/li>\r\n<li>\r\n<p>In case the file is missing, open the <strong>custom-function.php<\/strong> file and check if there&#8217;s already <strong>posts_grid<\/strong> code in the file: look for the posts_grid  with <strong>Ctrl\/Cmd+F5<\/strong> hotkeys.<\/p>\r\n<\/li>\r\n<li>\r\n<p>In case the code is missing, open the <strong>posts-grid.php<\/strong> file located in the <strong>wp-content\/plugins\/cherry-plugin\/includes\/shortcodes<\/strong> directory on server and copy the code that starts with:<\/p>\r\n<pre>function posts_grid_shortcode( $atts, $content = null, $shortcodename = '' ) {<\/pre>\r\n<p>And ends with:<\/p>\r\n<pre>add_shortcode('posts_grid', 'posts_grid_shortcode');<\/pre>\r\n<\/li>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/service-center\/\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-3-(835-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>\r\n<li>\r\n<p>Paste the code at the bottom of <strong>custom-function.php<\/strong> file before the closing <strong>?><\/strong> tag. Save changes in the file.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Find the posts title link in the source code:<\/p>\r\n<pre>&lt;a href=\"'.get_permalink($post_id).'\" title=\"'.get_the_title($post_id).'\"&gt;';\r\n\t\t\t$output .= get_the_title($post_id);\r\n\t\t$output .= '&lt;\/a&gt;<\/pre>\r\n<\/li>\r\n<li>\r\n<p>In order to open link in new tab, add <strong>target=&#8221;_blank&#8221;<\/strong> into the link code:<\/p>\r\n<pre>&lt;a target=\"_blank\" href=\"'.get_permalink($post_id).'\" title=\"'.get_the_title($post_id).'\"&gt;';\r\n\t\t\t$output .= get_the_title($post_id);\r\n\t\t$output .= '&lt;\/a&gt;<\/pre>\r\n<\/li>\r\n<li>\r\n<p> To modify the <strong>Read More button<\/strong> link, find the button link code which is the following:<\/p>\r\n<pre>&lt;a href=\"'.get_permalink($post_id).'\" class=\"btn btn-primary\" title=\"'.get_the_title($post_id).'\"&gt;';\r\n\t\t\t\t$output .= $link_text;\r\n\t\t\t$output .= '&lt;\/a&gt;<\/pre>\r\n<\/li>\r\n<li>\r\n<p>Add the same <strong>target=&#8221;_blank&#8221; attribute<\/strong> to the link code:<\/p>\r\n<pre>&lt;a target=\"_blank\" href=\"'.get_permalink($post_id).'\" class=\"btn btn-primary\" title=\"'.get_the_title($post_id).'\"&gt;';\r\n\t\t\t\t$output .= $link_text;\r\n\t\t\t$output .= '&lt;\/a&gt;<\/pre>\r\n<\/li>\r\n<li>\r\n<p>Save changes in the <strong>custom-function.php<\/strong> file. Refresh the page with Ctrl\/Cmd+F5 hotkeys to see changes on the site.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=GP7SXR5L1vo?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to make read more links of &#8220;post_grid&#8221; shortcode open in new tab<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to edit posts_grid shortcode so that Read More links and post titles opened in new tab in Wordpress.<\/p>\n","protected":false},"author":65,"featured_media":45985,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[1336,1917,1335,1415,977,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/45983"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=45983"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/45983\/revisions"}],"predecessor-version":[{"id":82600,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/45983\/revisions\/82600"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/45985"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=45983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=45983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=45983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}