Consistence of social share buttons broken on other pages then startpage

  • Author
    Posts
  • #39084

    Hi there.
    I’m new to this Forum. Nevertheless I hope you might help to answer my question.

    I did everything like explained here to add a new Social share button (it’s “WhatsApp”):
    https://www.cryoutcreations.eu/faq/e4-add-another-social-icon-nirvana

    Difference: I’m using already a child template. So I did all the steps to enhance my existing child theme.

    Result: Works fine on start page. but not on Sub pages.

    I’m using:
    WordPress 4.6.1
    Nirvana 1.2.5

    Anyone an idea of a possible solution?

    Best regards.
    j.

    #39184
    Zed
    Cryout Creations mastermind

    Are you using any kind of caching plugin?
    If the new social icon works fine on the homepage and you’ve copied the sample code exactly (and only modified the socials names) it has no reason to not work on other pages.
    You did not mention your site’s URL so I cannot take a look at what is going on.


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    #39230

    Thanks for caring ZED.

    Unfortunately we have no testing Environment – it is a production site.
    So I cannot enable the wrong behaviour with out scheduling a certain time for you!
    So my current timezone is MESZ. Maybe it is ok for you to schedule?
    And here’s the URL: hhtp://pension-weinig.de

    We do no Caching at all.

    The Error occurs even when I do not use the enhancement – It occurs if the enhancements of the theme is just in place.
    So I can force it: funtions.php in child theme: Error on subpages. rename function.php to something like “function.phpOFF” NO Error at all.

    What do you say?

    BR
    Jochen

    #39342
    Zed
    Cryout Creations mastermind

    Could you post the entire content of the problematic functions.php file?


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    #39469

    Sure.
    Here it is:

    <?php
    /**************************
    *  Nirvana extra social icons child theme example
    *  version 0.1 / 20150525 / for Nirvana v1.0.4 and up
    *  (c) Cryout Creations
    * ***********************/
    
    $extraSocials = array(
    	'WhatsApp',
    	// edit and/or add your extra socials here;
    	// leave this array empty if you only want to replace the images in your child theme
    	// the new social icons image files need to be placed in the nirvana-extrasocials/images/socials folder,
        // with the exact same name(s) used above; capitalization DOES matter!
    );
    
    // *** no configurables below; only edit if you know what you're doing ***
    
    // EXTRA SOCIAL ICONS CODE 
    // overload the social icons array
    function child_override(){
    global $socialNetworks, $extraSocials;
    if (is_array($socialNetworks))
          $socialNetworks = array_merge( $socialNetworks, $extraSocials );
    };
    // add hook for overload function
    add_action( 'after_setup_theme', 'child_override' );
    
    // custom child theme socials display function - it picks the image file if found in the child theme
    function nirvana_set_social_icons($idd) {
    	$cryout_special_keys = array('Mail', 'Skype');
    	global $nirvanas;
    	foreach ($nirvanas as $key => $value) {
    		${"$key"} = $value ;
    	}
    	echo '<div class="socials" id="'.$idd.'">';
    	for ($i=1; $i<=9; $i+=2) {
    		$j=$i+1;
    		if ( ${"nirvana_social$j"} ) {
    			if (in_array(${"nirvana_social$i"},$cryout_special_keys)) :
    				$cryout_current_social = esc_html( ${"nirvana_social$j"} );
    			else :
    				$cryout_current_social = esc_url( ${"nirvana_social$j"} );
    			endif;	
    			$icon = get_stylesheet_directory_uri().'/images/socials/'.${"nirvana_social$i"}.'.png';
                $childicon = get_stylesheet_directory().'/images/socials/'.${"nirvana_social$i"}.'.png'; 
    			
    			if (!file_exists($childicon)) { $icon = get_template_directory_uri().'/images/socials/'.${"nirvana_social$i"}.'.png'; }; ?>
    
    			<a rel="nofollow" href="<?php echo $cryout_current_social; ?>"
    			class="socialicons social-<?php echo esc_attr(${"nirvana_social$i"}); ?>" title="<?php echo ${"nirvana_social_title$i"} !="" ? esc_attr(${"nirvana_social_title$i"}) : esc_attr(${"nirvana_social$i"}); ?>">
    				<img />" src="<?php echo $icon; ?>" />
    			</a><?php
    		}
    	}
    	echo '</div>';
    } // nirvana_set_social_icons()
    // END EXTRA SOCIAL ICONS CODE
    
    ?>
    #39470

    Somehow the Settings field for the WhatsApp button seems not to accept the string “whatsapp://” and filters it as not allowed. Do you make any proof for Special expressions somewhere??

    #39724
    Zed
    Cryout Creations mastermind

    The theme uses WordPress sanitization functionality on all input fields (including social URLs) – and as whatsapp:// is not a valid protocol identifier is it most likely filtered out.

    The code looks right. How is the new social icon malfunctioning on sub-pages?


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Consistence of social share buttons broken on other pages then startpage’ is closed to new replies.