WordPress.org

Forums

Customizr
Missing Slider (23 posts)

  1. JodieRD
    Member
    Posted 8 months ago #

    I decided I didn't like the accordian slider I had installed so I deleted the appropriate code from my child theme. Then I followed the instructions to put a Customizr slider in and it isn't working. Could I have messed with any of the Customizr code? I thought it was in the parent theme, so I was safe.

    This is my site.

  2. nikeo
    Member
    Theme Author

    Posted 8 months ago #

    Hi @JodieRD, what you did seems perfectly correct and safe since you have been working with a child theme.

    Make sure you follow the different steps to add a Customizr slider with this tutorial.

    Hope this will help!

  3. JodieRD
    Member
    Posted 8 months ago #

    With that in mind and the tutorial (which I had been using) I checked my settings for a slider on the home page. All correct, but still didn't show up.

    So, I chose a random page and, using the instructions in the tutorial, put a slider on it. It didn't show up.

    What could it be other than it is looking for the code on the parent theme and isn't finding it?

    Thanks for your help Nikeo!

  4. ElectricFeet
    Member
    Posted 8 months ago #

    Could you post your child theme's functions.php in pastebin (if it's large) or here—in backticks— if it's just a few lines?

    I'm presuming you've already set a front page slider in Appearance > Customize > Front Page > Slider Options.

  5. JodieRD
    Member
    Posted 8 months ago #

    Hi ElectricFeet,

    Here's the pastebin link (hopefully I did it right!)

    Yes, and I triple checked everything about that front page slider. That's why I also tried putting one on another page; thinking maybe the slider code or something pointing to it is missing.

    I appreciate you taking time to help!

    Jodie

  6. ElectricFeet
    Member
    Posted 8 months ago #

    I'm assuming below that this functions.php is correctly-placed in your child-theme's folder.

    Your functions.php contains some old copies of Customizr code (from a very old version—a few functions don't exist any more). So you are running your own versions of Customizr functions and dynamically overwriting the core Customizr code. This will lead to unpredictable results and is probably (but not necessarily) responsible for the problems you are having.

    You only seem to have 2 functions in your code that are your own: One function that moves the meta information to the bottom of the post and another that centres your logo. All the other seem to be duplicates of Customizr.

    Your functions.php should contain the following; nothing else:

    <?php
    
    //we hook the code on the __before_body hook, which is executed before the <body> rendering.
    // added 2014-03-26 by KLN
    add_action ('__before_body' , 'move_single_post_metas');
    
    function move_single_post_metas() {
    	//checks if we are displaying a single post. Returns false if not.
    	if ( !is_single() )
    		return;
    	//we remove the original action hooked on '__post_metas'. tc_post_metas action is a method of the TC_post_metas class
    	//We can access the instance of this class with a static property of this class that is a self instance.
    	remove_action  ( '__after_content_title' , array( TC_post_metas::$instance , 'tc_post_metas' ));
    
    	//we add the tc_post_metas action on a the __after_loop (check index.php file to see where this hook is called in the code)
    	add_action ('__after_article' , array( TC_post_metas::$instance , 'tc_post_metas'), 10);
    
    	//Additional action to display an hr separator between content and metas.
    	//We use the priority parameter to determine the rendering order of the action
    	add_action ('__after_article' , 'display_hr', 0);
    
    	//this is a nested function (function in another function), allowed with PHP.
    	function display_hr() {
    		?>
    			<hr/>
    		<?php
    	}
    }
    //end move meta function        
    
    // Center the logo from Customizr Code Snippet
    add_filter('tc_logo_text_display', 'your_logo_display');
    add_filter('tc_logo_img_display', 'your_logo_display');
    function your_logo_display($output) {
    	return preg_replace('/brand span3/', 'brand span10 offset1', $output, -1);
    }

    Replace the whole child-theme functions.php text with the above and report back.

  7. JodieRD
    Member
    Posted 8 months ago #

    Thanks!
    I removed the old code and pasted yours in. This is what I got:

    Parse error: syntax error, unexpected '&' in /home/content/77/9269677/html/wp-content/themes/customizr-child/functions.php on line 27

    Line 27 though is a
    }
    If I counted the lines correctly.

    Am laughing about "old code" as I created this site this year.
    "Old" is relative!

  8. ElectricFeet
    Member
    Posted 8 months ago #

    Do you have a cache to clear?

  9. JodieRD
    Member
    Posted 8 months ago #

    Looked that up and the WordPress documentation said to look at plugins for caches that may need clearing. But now I can't get to them. I tried putting in my old code into functions.php from pastebin but now it's giving me the same error message. Perhaps that's a clue?

  10. ElectricFeet
    Member
    Posted 8 months ago #

    Could you just delete your child theme's functions.php for now so that we have a slightly cleaner slate?

  11. JodieRD
    Member
    Posted 8 months ago #

    Good idea.
    Done. And the site is now up again.

  12. ElectricFeet
    Member
    Posted 8 months ago #

    Now create a new functions.php in your child theme with just <?php

    Test that it works. If it does, then add:

    //we hook the code on the __before_body hook, which is executed before the <body> rendering.
    // added 2014-03-26 by KLN
    add_action ('__before_body' , 'move_single_post_metas');
    
    function move_single_post_metas() {
    	//checks if we are displaying a single post. Returns false if not.
    	if ( !is_single() )
    		return;
    	//we remove the original action hooked on '__post_metas'. tc_post_metas action is a method of the TC_post_metas class
    	//We can access the instance of this class with a static property of this class that is a self instance.
    	remove_action  ( '__after_content_title' , array( TC_post_metas::$instance , 'tc_post_metas' ));
    
    	//we add the tc_post_metas action on a the __after_loop (check index.php file to see where this hook is called in the code)
    	add_action ('__after_article' , array( TC_post_metas::$instance , 'tc_post_metas'), 10);
    
    	//Additional action to display an hr separator between content and metas.
    	//We use the priority parameter to determine the rendering order of the action
    	add_action ('__after_article' , 'display_hr', 0);
    
    	//this is a nested function (function in another function), allowed with PHP.
    	function display_hr() {
    		?>
    			<hr/>
    		<?php
    	}
    }
    //end move meta function

    If that works, then add:

    // Center the logo from Customizr Code Snippet
    add_filter('tc_logo_text_display', 'your_logo_display');
    add_filter('tc_logo_img_display', 'your_logo_display');
    function your_logo_display($output) {
    	return preg_replace('/brand span3/', 'brand span10 offset1', $output, -1);
    }

    Once we've got that up and running, we can check out why your slider isn't showing. I think it's probably one of your plugins. You will need to deactivate them all and then reactivate one by one to see which causes the issue.

  13. JodieRD
    Member
    Posted 8 months ago #

    I made the functions.php file in the child theme and put in
    <?php

    Go an error again. So I fiddled around and put in
    <?php
    ?>

    My page came u as it was.

    So I added the first big block of code you gave me. After the first two lines. No change. Then I took away the second line I had added. No change. Then I put that second line at the end. No change. same with putting it before the last line, //end...

    Rats!

    Is this helpful doc?

  14. JodieRD
    Member
    Posted 8 months ago #

    Oh wait. I didn't read to the end. So all we're after visually is for
    a.the site to stay up and
    b. the logo to get centered.

    Added your second block and yes the logo is centered, site is up. On to disabling plugins.

    Sorry to be dense. And I'm a writer and editor. No excuse.

  15. JodieRD
    Member
    Posted 8 months ago #

    All deactivated. Still no slider. Brought the site up on my other computer. Nope.
    Chose to add the slider on another random page. No dice.
    Since it isn't working there's no reason to go through the process of reactivating each one in turn I presume?

  16. ElectricFeet
    Member
    Posted 8 months ago #

    I'm still seeing an "fbq" (facebook ?) script running...

  17. JodieRD
    Member
    Posted 8 months ago #

    There's a Facebook Page Publish app but it does say Activate so it's inactive. Should I delete it to be sure?
    What else could it be?

  18. ElectricFeet
    Member
    Posted 8 months ago #

    No, don't delete it.

    If your functions.php doesn't contain any code that relates to this and all your plugins are deactivated, and your cache was cleared(?), then it looks like you may have modified core Customizr code.

    Oh wait, there's another possibility. What other files do you have in your child theme? Are there any other php files in there? They will overrule Customizr files with the same name.

  19. JodieRD
    Member
    Posted 8 months ago #

    Hee hee yes, header.php under my child theme.

    I didn't clear my cache. How do I do that?

  20. ElectricFeet
    Member
    Posted 8 months ago #

    Paste your header.php on pastebin. It's likely to be the cause of your slider problem.

    If you don't know how to clear your cache, then you may not even have a cache. I was just checking.

    The header.php will likely be your problem. Reactivate everything else and let's see what's in there.

  21. JodieRD
    Member
    Posted 8 months ago #

    Aha! And there's a facebook reference in there.
    (Hope I'm inserting this correctly.)

    <?php
    /**
     * The Header for Customizr.
     *
     * Displays all of the <head> section and everything up till <div id="main-wrapper">
     *
     * @package Customizr
     * @since Customizr 1.0
     */
    ?>
    <!DOCTYPE html>
    <!--[if IE 7]>
    <html class="ie ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if IE 8]>
    <html class="ie ie8" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if !(IE 7) | !(IE 8)  ]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    <?php tc__f('rec' , __FILE__ , __FUNCTION__ ); ?>
    
    	<?php do_action( '__before_body' ); ?>
    
    	<body <?php body_class(); ?> itemscope itemtype="http://schema.org/WebPage">
    
    		<?php do_action( '__before_header' ); ?>
    
    	   	<header class="tc-header clearfix row-fluid" role="banner">
    
    			<?php do_action( '__header' ); ?>
    
    <!-- Facebook Conversion Code for FB Checkouts -->
    <script>(function() {
      var _fbq = window._fbq || (window._fbq = []);
      if (!_fbq.loaded) {
        var fbds = document.createElement('script');
        fbds.async = true;
        fbds.src = '//connect.facebook.net/en_US/fbds.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(fbds, s);
        _fbq.loaded = true;
      }
    })();
    window._fbq = window._fbq || [];
    window._fbq.push(['track', '6019163291035', {'value':'0.00','currency':'USD'}]);
    </script>
    <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6019163291035&cd[value]=0.00&cd[currency]=USD&noscript=1" /></noscript>         
    
    		</header>

    Deleted the entire file (saved it to a Word doc) and the slider is working.

    Reactivated plugins and updated those that had updates, and all is well.

    Thank you for spending precious time helping me. I learned a lot. The kindness of strangers!

  22. ElectricFeet
    Member
    Posted 8 months ago #

    You did well to delete header.php from your child theme, because it's not future-proof to add the code like that (as you've found out).

    I don't know what that code does (apart from knowing that allows facebook to track everyone around the web, of course). If you want to add it back to your site then you can add the following in your functions.php:

    // Facebook Conversion Code for FB Checkouts
    add_action('wp_head','my_facebook_script');
    function my_facebook_script() {
        ?>
            <script>(function() {
              var _fbq = window._fbq || (window._fbq = []);
              if (!_fbq.loaded) {
                var fbds = document.createElement('script');
                fbds.async = true;
                fbds.src = '//connect.facebook.net/en_US/fbds.js';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(fbds, s);
                _fbq.loaded = true;
              }
            })();
            window._fbq = window._fbq || [];
            window._fbq.push(['track', '6019163291035', {'value':'0.00','currency':'USD'}]);
            </script>
        <?php
    }

    Thanks for the thanks :-)

  23. JodieRD
    Member
    Posted 8 months ago #

    I'll just leave it out.

    THANKS AGAIN!!!

Reply

You must log in to post.

About this Theme

About this Topic