jQuery Gallery is not working in WordPress - css

Even though, I used same code for both of them http://bda.ctuproject.com/ is not showing tip image. When you go over any item in http://bda.ctuproject.com/wp-content/themes/twentyten/exam/index.html you will see that box will come up saying what is that picture but it's not doing it when I put it in WordPress. Why any ideas ?
http://bda.ctuproject.com
http://bda.ctuproject.com/wp-content/themes/twentyten/exam/index.html

i think you're calling the jquery script twice

As #Colby said, you are loading jQuery twice. Try putting this into your active theme's functions.php file to deregister the WP jQuery load:
if( !is_admin()){
wp_deregister_script('jquery');
}

Related

Elementor - adding custom code right after the <head> tag

Not sure if this is only problem for Elementor full width template, but it seems to override theme header.php. I tried achieving my goal by using elementor custom code feature, but it adds my code somewhere in middle of the tag.
What is the propper way of adding my own custom code as the first thing that is after the element?
You are right Elementor overrides the theme's header.php file so importing your code to this file is not effective. You need to add custom function to earn your goal. With the wp-head action you could add the code right into your header and Elementor will not override it.
Add this code to the functions.php file od your active theme.
add_action('wp_head', 'custom_head_function');
function custom_head_function(){
?>
YOUR HEADER CODE HERE
<?php
};
UPDATE - If you want to set your code at the top
As sephsekla mentioned in comment, there is a way to set the priority into your action to get it to the top. Try to set value to -999. So, choose a very low number and if there is no other lower number in your plugin or theme you will go straight to the top.
add_action('wp_head', 'custom_head_function', -999);
function custom_head_function(){
?>
YOUR HEADER CODE HERE
<?php
};
Elementor now supports custom code (javascript, html, etc) and supports the specific use of elements in the head of the page.
What you are looking for you can find at the Wordpress Dashboard> Elementor > Custom Code . Then you will be able to add a custom code to the head: https://elementor.com/help/custom-code-pro/

How to fix code from not displaying on wordpress page

This code will not display on any of my wordpress pages. It returns a blank page even when I load from incognito mode.
<script defer src="https://connect.podium.com/widget.js#API_TOKEN=91c679dc-e819-4506-851e-f4cd664249ae" id="podium-widget" data-api-token="91c679dc-e819-4506-851e-f4cd664249ae"></script>
If you would like this script to show up on all your pages, you can use the wp_enqueue_scripts action. This code should be added into your functions.php file inside of your theme. Below is an example of doing that.
//enqueue our scripts and styles
function mydomain_add_theme_scripts() {
wp_enqueue_style('Podium', 'https://connect.podium.com/widget.js#API_TOKEN=91c679dc-e819-4506-851e-f4cd664249ae');
}
//bind custom script and style load
add_action( 'wp_enqueue_scripts', 'mydomain_add_theme_scripts' );
Please me know if that works for you. If not, share any console errors, etc.

wp_dequeue_style not seems to working

I'm build a wordpress theme and I've created in my style.css a custom class for the plugin: Social Count plus
The problem's that plugin use an own css called counter.css what I need to do is prevent the inclusion of this css, so I've inserted this line in my functions.php:
wp_dequeue_style( 'counter' );
unfortunately the style is even included during the site reload. What am I doing wrong?
Thanks.
Try this:
add_action('wp_enqueue_scripts', function() {
wp_dequeue_style('social-count-plus');
wp_deregister_style('social-count-plus');
});
Just leave the counter.css file in place but either empty it out or comment everything out. It can't load what's not there. Be aware though, and update to that plugin might add the contents of that file back.

How to use ajax pagination in wordpress

I have created custom post type 'portfolio' in my wordpress application.
I am using wp-pagenavi plugin for pagination of custom posts.Can anyone guide me how will I implement ajax pagination i.e load newer posts without reloading the whole page. Any help will be greatly appreciated...
/*******ajax pagination*******/
jQuery(document).on('click', '#pagination a', function(e){
e.preventDefault();
var link = jQuery(this).attr('href');
jQuery('#content').html('Loading...'); //the 'main' div is inside the 'content' div
jQuery('#content').load(link+' #main');
});
the .live() function has been depreciated so use .on() instead.
obviously the jQuery library is needed too.
Here's a couple of options you can try:
AJAXify WordPress Tutorial
AJAXify WordPress Plugin
I've used the first option, its a good tutorial. I know it works. You may need to modify it some though. I cannot vouch for the second option as I've never used it. Just a quick Google search turned it up though.

use javascripts objects into a wordpress theme

I save an html page that has an image rotator that work by using javascript, and after I save it work correctly.
I convert this html page to a wordpress theme but the rotator don't work anymore.
what's the problem?
please help me.
Wordpress insert embeded jquery script using wp_enqueue_script.
Check that jQuery inserted just one time in your theme! You can disable auto insertion by adding this code in function.php file:
wp_deregister_script('jquery');
and take a look at this.

Resources