Tag Info

New answers tagged

-1

You can try this <?php // use this in function.php add_filter('wp_head', 'your_function'); function your_function() { ?> <script> var t = window.innerWidth; if (t < 768 ) { <?php wp_enqueue_style( 'wpm_animation_css', get_template_directory_uri() . '/assets/css/animation.css', array(), '1.1', false ); ...


-2

At this point I can not think of a way to do what you ask in php (maybe in javascript), but perhaps approaching the problem differently, can serve you detect the mobile device in a better way using mobile-detect[1], wp_is_mobile() as it is very basic, only detects if mobile, but does not distinguish between phones or tablets. And there is already a plugin ...


0

We got it working. We used a plugin called the Javascript & CSS toolbox to store our individual code blocks and then we put the html code in the page content pane and it worked brilliantly.


-1

Use: wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/<version of required version of jquery>/jquery.min.js", false, null); wp_enqueue_script('jquery'); just before wp_head() I am not sure if this method is faster than ...


0

EDIT: Changed the code to be used in a plugin. Okay, with the info you provided, you can do something like this: Step 1) Put your Javascript Map Loading stuff into a .js file. Save it somewhere in your plugin directory, like "myplugin/mapscript.js" Step 2) create a file in your plugin directory, like "myplugin/myplugin.php". Insert the Plugin header so ...


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 ...


0

Sounds like what you need is a page template. This will allow you to enter your PHP (and any other code) in the appropriate place to generate the content on the frontend. Starting with a copy of your theme's current page.php file is usually a good place to start. Modify the main area with your code, upload the file and select it as the page template in ...


0

To use the unminified code, you can just unregister the minified JS and register the non-minified code. However, there's really no reason to do this if you just want to explore the code.. just view the file in your IDE. All of the files are in '/wp-admin/js'.


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

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 ...


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 ...


0

This is not a real answer regarding the question. The only effective but dirty solution seems to be in hooking into : 'option_active_plugins' and kick off all other plugins but yours. That of course leaves the admin interface in a very confusing state to the user but at least you can avoid collisions between modern Javascript applications or Javascript ...


1

Your question is a bit broad. We actually have a one question per post policy. I'm going to try to answer though My first question is, shouldn't most themes that you download out there automatically include jQuery in your header anyway? Well, basically correct. So many features today in a theme needs jquery to run properly. I haven't came across a ...


0

Sometimes the best recommendation is to abandon an idea. And this is my recommendation: Do not try to push Interface elements from interface A into interface B. Imagine that you bought yourself a Porsche. And then imagine you get into your new car, which comes with a set of expectations that you have, and suddenly you are looking at the dashboard of a ...



Top 50 recent answers are included