Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21167
    jabbadu
    Member

    Hi,

    Is there a possibility to disable the target=”_blank” for the Homepage Button?
    I just found something at the functions.php but it doesn’t work..

    Great Theme by the way! My favourit one.. *thumbsup*

    #21177
    Sakin
    Keymaster

    @jabbadu: Are you talking about the button in Homepage Headline? There is no option at this stage to change it. But you can change it by customizing the catchkathmandu_homepage_headline function in your child theme. So, first build child theme and create functions.php file in your child theme and then add the following code

    <?php 
    /**
     * Template for Homepage Headline
     *
     * To override this in a child theme
     * simply create your own catchkathmandu_homepage_headline(), and that function will be used instead.
     *
     * @uses catchkathmandu_before_main action to add it in the header
     * @since Catch Kathmandu Pro 1.0
     */
    function catchkathmandu_homepage_headline() { 
    	//delete_transient( 'catchkathmandu_homepage_headline' );
    	
    	global $post, $wp_query, $catchkathmandu_options_settings;
       	$options = $catchkathmandu_options_settings;
    	
    	// Getting data from Theme Options
    	$disable_headline = $options[ 'disable_homepage_headline' ];
    	$disable_subheadline = $options[ 'disable_homepage_subheadline' ];
    	$disable_button = $options[ 'disable_homepage_button' ];
    	$homepage_headline = $options[ 'homepage_headline' ];
    	$homepage_subheadline = $options[ 'homepage_subheadline' ];
    	$homepage_headline_button = $options[ 'homepage_headline_button' ];
    	$homepage_headline_url = $options[ 'homepage_headline_url' ];
    	
    	// Front page displays in Reading Settings
    	$page_on_front = get_option('page_on_front') ;
    	$page_for_posts = get_option('page_for_posts'); 
    
    	// Get Page ID outside Loop
    	$page_id = $wp_query->get_queried_object_id();
    
    	 if ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && ( empty( $disable_headline ) || empty( $disable_subheadline ) ) ) { 	
    		
    		if ( !$catchkathmandu_homepage_headline = get_transient( 'catchkathmandu_homepage_headline' ) ) {
    			
    			echo '<!-- refreshing cache -->';	
    			
    			$catchkathmandu_homepage_headline = '<div id="homepage-message" class="container"><div class="left-section">';
    			
    			if ( $disable_headline == "0" ) {
    				$catchkathmandu_homepage_headline .= '<h2>' . sprintf( __( '%s', 'catchkathmandu' ) , $homepage_headline ) . '</h2>';
    			}
    			if ( $disable_subheadline == "0" ) {
    				$catchkathmandu_homepage_headline .= '<p>' . sprintf( __( '%s', 'catchkathmandu' ) , $homepage_subheadline ) . '</p>';
    			}			
    			
    			$catchkathmandu_homepage_headline .= '</div><!-- .left-section -->';  
    			
    			if ( !empty ( $homepage_headline_url ) && $disable_button == "0" ) {
    				$catchkathmandu_homepage_headline .= '<div class="right-section"><a href="' . $homepage_headline_url . '" target="_self">' . $homepage_headline_button . '</a></div><!-- .right-section -->';
    			}
    			
    			$catchkathmandu_homepage_headline .= '</div><!-- #homepage-message -->';
    			
    			set_transient( 'catchkathmandu_homepage_headline', $catchkathmandu_homepage_headline, 86940 );
    		}
    		echo $catchkathmandu_homepage_headline;	
    	 }
    }
    #47080
    Anonymous
    Inactive

    OR..
    if you want to avoid building a child theme only to fix a terget=”_blank” (like me), add these lines in Theme Options > Tools > Code to display on Header :

    <script type=”text/javascript”>
    function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName(“a”);
    for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (
    anchor.getAttribute(“href”) && (
    anchor.getAttribute(“target”) == “_blank” )
    )
    anchor.target = “_self”;
    }
    }
    jQuery(document).ready(function() {
    externalLinks();
    });
    </script>

    #47123
    Sakin
    Keymaster

    @ClaudioC: Thanks and when post these type of script. Please use code command or paste your code in https://gist.github.com/ and add in the URL here. Thanks a lot.

    #47131
    Anonymous
    Inactive

    Ok @Sakin , here it is: https://gist.github.com/anonymous/1402f64c89b0e3ff224b

    Unfortunately I had to change theme in my wp project because catch kathmandu was performing really bad in terms of loading time (5-10 sec), can’t figure out why (no change with/without plugins, changing theme performs better)

    #47173
    Sakin
    Keymaster

    @ClaudioC: Thanks for the code. It’s strange why you have loading issues. We have heavy image in our demo site and without cache plugin and it still loads fast. See this http://tools.pingdom.com/fpt/#!/c9K0gR/http://catchthemes.com/demo/catch-kathmandu/

    Did you try adding in W3 Total Cache plugin. Most of the loading issue are from images.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Homepage Button target="_blank"’ is closed to new replies.