Forum Replies Created

Viewing 15 replies - 1 through 15 (of 29 total)
  • Thread Starter digitalsky

    (@digitalsky)

    That fixed it! Looks like I managed to overlook that one particular style. I don’t even recall seeing that in the CSS inspector in Chrome. Thanks for solving this for me. Sometime sit really pays to have a second set of eyes.

    Thread Starter digitalsky

    (@digitalsky)

    Thanks Hannah, I’ll definitely check out that link. That looks like exactly what I might need.

    Thread Starter digitalsky

    (@digitalsky)

    So this new version only imports the events that I say I’m “interested” in via my personal Facebook profile?

    That’s kind of annoying because then I have to go through and mark that I’m interested in every single event that I publish on my businesses Facebook page.

    Thread Starter digitalsky

    (@digitalsky)

    Solved it myself using this:

    // Display coupon code used and coupon description in admin new order email
    add_action('woocommerce_email_after_order_table', 'apply_product_on_coupon');
        function apply_product_on_coupon() {
            global $woocommerce;
    
            if ( ! empty( $woocommerce->cart->applied_coupons ) ) {
                 $my_coupon = $woocommerce->cart->get_coupons() ;
                 foreach($my_coupon as $coupon){
    
                    if ( $post = get_post( $coupon->id ) ) {
                            if ( !empty( $post->post_excerpt ) ) {
    							echo "<h2>Coupons Used</h2>";
                                echo "<p><strong>".$coupon->code."</strong>";
                                echo " (".$post->post_excerpt.")</p>";
                            }
                    }
                }
            }
        }
    Thread Starter digitalsky

    (@digitalsky)

    This is one of those things where it’s not so much a particular product page that would have a different set of styling, it’s more over a set of products that might have a different page style then another set of products. So, I’m not sure if the body classes would work for those but I will look into that.

    Thread Starter digitalsky

    (@digitalsky)

    True, I didn’t think about that. I could just add conditional code to the single-product.php template so that all products in X category use whatever special styling I want, right?

    I guess in my mind I just thought it would be cool (cleaner) if the product pages had an option on them to select a template from a drop down menu. Actually, I’m pretty surprised that no other third party has made a plugin / add-on to allow this.

    I can make due for now with the conditional code though.

    Thread Starter digitalsky

    (@digitalsky)

    So there is no possible way to allow for two different product page styles? That seems like a huge limitation. I mean what if I wanted to have a few different types of products, each with their own page design / style?

    Thread Starter digitalsky

    (@digitalsky)

    Anyone out there?

    Thread Starter digitalsky

    (@digitalsky)

    I figured it out. This is the code that did the trick (this goes in the function.php file)…

    // Add our own JavaScripts.
    function custom_scripts()
    {
    	// Register the scripts
    	wp_register_script( 'modernizr', get_template_directory_uri() . '/js/modernizr-2.6.2.min.js', array(), '2.6.2', false );
    	wp_register_script( 'formalize', get_template_directory_uri() . '/js/jquery.formalize.min.js', array(), '1.0', false );
    	wp_register_script( 'social', get_template_directory_uri() . '/js/social.js', array(), '1.0', true );
    
    	// Enqueue the scripts:
    	wp_enqueue_script( 'modernizr' );
    	wp_enqueue_script( 'formalize' );
    
    	// Only enqueue the social script if we're on a 'single' post page (we don't want this script being loaded on pages without the social sharing icons):
    	if ( is_single() ) {
    		wp_enqueue_script( 'social' );
    		echo '<script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>';
    	}
    }
    add_action( 'wp_enqueue_scripts', 'custom_scripts' );

    That code enqueues all of my scripts I’ve added on. It also detects whether the visitor is on a single post page and if so it loads the social.js script (which controls all my social media sharing buttons) in the footer of the site. Works like an absolute charm and ensures that these scripts are not being loaded on pages that don’t need it. This is a nice fix for anyone who is concerned about page speed.

    Thread Starter digitalsky

    (@digitalsky)

    Of course, I spoke to soon. Here’s the issue now. I’m enqueueing the script in my functions.php file like this…

    // Add our own JavaScripts.
    function custom_scripts()
    {
    	// Register the scripts
    	wp_register_script( 'modernizr', get_template_directory_uri() . '/js/modernizr-2.6.2.min.js', array(), '2.6.2', false );
    	wp_register_script( 'formalize', get_template_directory_uri() . '/js/jquery.formalize.min.js', array(), '1.0', false );
    	wp_register_script( 'social', get_template_directory_uri() . '/js/social.js', array(), '1.0', true );
    
    	// Enqueue the scripts:
    	wp_enqueue_script( 'modernizr' );
    	wp_enqueue_script( 'formalize' );
    	wp_enqueue_script( 'social' );
    }
    add_action( 'wp_enqueue_scripts', 'custom_scripts' );

    Note that the script I’m trying to work with here is the ‘social’ one in the code above.

    Now the problem I am having is that when I enqueue that code it works great and shows up in the footer but now of course I can’t use that code from my previous post that detects if it’s a single post page and then displays that code. The enqueue code I am using by default just inserts the script in the header or footer (whichever you tell it to).

    Thread Starter digitalsky

    (@digitalsky)

    Gotcha, I wasn’t aware of that being that I’m more of a ‘designer’.

    I added the majority of the social sharing buttons to one .js file I created here…

    http://198.1.77.196/~larog/wp-content/themes/larog/js/social.js

    That should clean things up by allowing me to call on one file instead of a bunch.

    I’ll enqueue that in my functions.php file and it just dawned on my I know how to make this code only appear on the single post pages by using this code…

    <?php if ( is_single() ) {
    	echo
    		'<script type="text/javascript" src="/~larog/wp-content/themes/larog/js/social.js"></script>'
    	. single_cat_title() . ' category!';
    }
    ?>

    Looks like I answered my own question (but thanks for the enqueue reminder, I thought you only had to do that on .js files hosted on my own server). Sometimes I have moments where the obvious solution will easily elude me.

    Thread Starter digitalsky

    (@digitalsky)

    I’m not sure if I need to do that since one of them is just an inline JavaScript snippet that looks like this…

    <script type="text/javascript">
    			(function(d){
    				var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
    				p.type = 'text/javascript';
    				p.async = true;
    				p.src = '//assets.pinterest.com/js/pinit.js';
    				f.parentNode.insertBefore(p, f);
    			}(document));
    		</script>

    And the other looks like this…

    <script src="//platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>

    Does it still need to be enqueued if it’s not actually a JavaScript file?

    This plugin is not fully compatible with 3.6. The plugin developers have not updated it.

    My Facebook buttons don’t work either. This plugin is only compatible up to WordPress 3.5.2. If you’re running the latest version (like I am) it won’t work correctly.

    digitalsky

    (@digitalsky)

    I’m not sure how to do it but I am having the same issue as well. When you enable WP Customer Reviews it get’s rid of whatever other menu item is normally in that place.

Viewing 15 replies - 1 through 15 (of 29 total)