getting a js file for one page

You’re registering/enqueueing your script wrong. You should register/enqueue in your theme’s functions.php file instead of inside the header/page. Also, you need to use your theme’s directory … which will be along the lines of mydomain.com/wp-content/themes/BLANK-Theme/js/SliderViewer-1.2.js. Use this code in functions.php: function my_scripts_enqueue_method() { wp_enqueue_script( ‘SliderViewer’, get_template_directory_uri() . ‘/js/SliderViewer-1.2.js’ ); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts_enqueue_method’ ); This … Read more

Avoiding Duplicate function names in Post Loop (WP_Footer script)

I would wrap the whole thing in a class and put your data into a class var. class WPA69616_Plugin { private $data=””; public function __construct() { add_shortcode(‘my_shortcode’, array($this, ‘add_content’)); add_action(‘wp_footer’, array($this, ‘output_content’)); } public function add_content($atts) { extract( shortcode_atts( array( ‘content’ => ” ), $atts ) ); $this->data .= $content; } public function output_content() { … Read more

Problem with wp_enqueue_scripts in plugin

Because calc_script is inside your class, it’s not publicly available like a regular function. So, change your enqueue call to this: add_action( ‘wp_enqueue_scripts’, array( $this , ‘calc_script’ ) ); And make calc_script() public. Edit: Your add_action() is in the class as well, it needs to be in another function, preferably one hooked to the init … Read more

Trying to add script to specific admin page is not working

I think you’re using the wrong approach. Rather than removing the submenu item, alter how the post type was registered, and change the show_in_menu argument. Hook into init way late and change the argument. <?php add_action(‘init’, ‘wpse99123_post_type_switcher’, 999); function wpse99123_post_type_switcher() { global $wp_post_types; $wp_post_types[‘contact’]->show_in_menu = true; // put it back in the menu } Then, … Read more

Including style.css in Child Theme

get_stylesheet_uri will return the current theme’s stylesheet– the child stylesheet if it is a child theme. While not entirely clear from the Codex entry for that function, it is clear from the entry for get_stylesheet_directory_uri, which is used by get_stylesheet_uri. What should be happening is that the child stylesheet is being enqueued twice under different … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)