Display PHP within HTML values

If the function returns a printed value: <a href=”https://wordpress.stackexchange.com/questions/145222/<?php bloginfo(“url’); ?>”>Link</a> If not (using the echo statement): <a href=”https://wordpress.stackexchange.com/questions/145222/<?php echo get_stylesheet_directory_uri(); ?>”>Link</a> You can also use print() as part of a more complex expression where echo cannot. By the contrary, when you want to use HTML into PHP, I recommend to close PHP and open … Read more

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

Apple push notification doesn’t work

OMG, finally, as the code runs from the plugin, the current working directory is set to wp-admin whereas when i run it manually it set for /wp-content/plugins… So, when the push function is called, just add the following line of code: chdir(ABSPATH . ‘wp-content/plugins/*your plugins folder name*/’);

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