Tag Info

Hot answers tagged

2

I'm not sure I fully understand, but this isn't the recommended way to load js in WordPress. You normally would load scripts using a special WordPress function in your theme's functions.php file. It's wp_enqueue_script(). More here: http://codex.wordpress.org/Function_Reference/wp_enqueue_script By the way, WP also has its own function that essentially is ...


1

Solution #1 (not ideal, but it works): // Live Chat Utility Link add_filter( 'wp_nav_menu_items', 'live_chat_utility_link', 10, 2 ); function live_chat_utility_link ( $items, $args ) { if ( $args->theme_location == 'utility' ) { $items .= '<li><a href="javascript:void(0);" onclick="olark(\'api.box.expand\')" class="livechat">Live ...


1

Good that it works. If it's for a client or if you just want cleaner code, you can do it as @Tom J Nowell suggested. Add a custom menu item, link it to nowhere or anywhere. Find out the menu item ID (every item has one), and then target that ID with jQuery. $("#menu-item-num").on("click", function(e){ e.preventDefault(); // olark code here ...


1

Just a simple php if to check the contents of the field before outputting markup. <?php if( $second_comment = get_field('second_content_block') ){ ?> <div class="page-content-text-additional"> <?php echo do_shortcode("[vr_jsp] $second_comment [/vr_jsp]"); ?> </div> <?php } ?> You can eliminate the need ...


1

I'm not sure if this question is still relevant or not (so I'm posting for future reference for people), but there is a way to define a css file for the TinyMCE editor in your plugin by using the mce_css filter. For a quick example, I'll take an excerpt from the WordPress documentation: function plugin_mce_css( $mce_css ) { if ( ! empty( $mce_css ) ) ...


1

Here is what I ended up doing based on @gdaniel's suggestion: AJAX call: $('.btn').click(function() { $.ajax({ url:"<?php bloginfo('template_directory'); ?>/inc/galleries.php", type: 'POST', data: {postID: '<?=$post->ID;?>', galleryCategory: $(this).attr("data-content")}, success: function(resp) { ...



Only top voted, non community-wiki answers of a minimum length are eligible