Ajax – Call to undefined function get_option()

You’re firing a request to a PHP file that won’t have the WordPress library loaded – hence the undefined function error. You could manually load in WordPress with something like require ‘../../../wp-load.php’. Or, better yet, use the awesome AJAX API. Just fire your request to wp-admin/admin-ajax.php and then register a callback in your plugin or … Read more

Parse error syntax error unexpected t_string [closed]

The problem is that you forgot a apostrophe after ‘jquery-qtip-min) wp_register_script( ‘tooltip’, get_stylesheet_directory_uri() . ‘/qtip-js/tooltip.js’, array(‘jquery’, ‘imagesloaded’, ‘jquery-qtip-min), false, true ); should be wp_register_script( ‘tooltip’, get_stylesheet_directory_uri() . ‘/qtip-js/tooltip.js’, array(‘jquery’, ‘imagesloaded’, ‘jquery-qtip-min’), false, true ); I know that sometimes you can look over such things, especially if (maybe) you aren’t an experienced coder, but still please … Read more

Add a variable in functions.php and call it in single.php

either use global variable in functions.php: global $prevPost; $prevPost = 10; in single.php : global $prevPost; if($prevPost) .. . . . Your code continues. . Second method: define a function in functions.php and call that in single.php in functions.php : function func_prevPost(){ $prevPost = 10; return $prevPost; } in single.php : if(func_prevPost()){ // your code … Read more

How to use my style.css file outside of wordpress subdomain?

If you’re using an absolute reference like that, you’d want to include the full file path, like http://diginomics.com/wp-content/themes/THEMENAME/css/style.css I believe any time you call the functions like get_stylesheet_directory() or get_stylesheet_directory_uri() it will return the path for the current theme. Just keep in mind that all themes need a style.css file. I would have posted this … Read more

How to change home or site url using action hooks or filter?

Ok. Then you can use template_redirect hook and wp_is_mobile() conditional tag. wp_is_mobile() will work on device only. If you resize the window then it will not work. Now you can try this kind of code in your functions.php file add_action(‘template_redirect’, ‘redirecting_to_mobile_site’); function redirecting_to_mobile_site(){ if( wp_is_mobile() ){ wp_redirect( ‘http://m.example.com’, 301 ); exit; } }

Fatal Error relating to sessions.php

I fixed it by: 1) checking wordpress version in: /home/myusername/public_html/version.php 2) downloading this version package from wordpress website 3) addingwp-includes/session.php file from downloaded package into /home/myusername/public_html/wp-includes/session.php (that file was empty or not existing)

How to use an associative array in post__in with WP_Query?

Take a look at PHP’s array_values function. Alternatively, you could typecast. Note that if the array is in serialized form as you have put it above, you will have to unserialize it first, in either case. $numerical_array = array_values( unserialize( ‘a:1:{s:8:”post-134″;s:3:”134″;s:8:”post-136″;s:3:”136″;}’ ) ); or $numerical_array = (array) unserialize( ‘a:1:{s:8:”post-134″;s:3:”134″;s:8:”post-136″;s:3:”136″;}’ );