How to output functions from plugin inside theme

Looks like function render_content_show_hide() is a method of class. If you want access this function directly – you can create new class instance. If your plugin code looks like: class Shortcode_Builder{ //…methods public function render_content_show_hide( $attr, $content = null, $shortcode_name=”” ) { //… } //…other methods. } Create new instance $builder = new Shortcode_Builder(); And … Read more

How to remove some item from WordPress Dashboard for user Author

Two edits: checking for a role is not recommended, you want to check for a capability instead; and the php file you want to pass is edit-comments.php. <?php add_action( ‘admin_menu’, ‘my_menu_links_removing’, 999 ); function my_menu_links_removing() { if ( ! current_user_can(‘activate_plugins’) ) { remove_menu_page( ‘edit-comments.php’ ); } } ?> Administrators are the only default role (besides … Read more

Where is this JQuery coming from?

I understand that this loads JQuery throughout my website – but here’s the odd thing, if I change the version of JQuery is does NOT update. It’s not odd. You can’t load arbitrary versions of jQuery by changing the version argument. From the documentation for wp_enqueue_script(), that version number is: String specifying script version number, … Read more

I can’t add CSS with functions.php

Before adding any file you must seperate your header.php file & add wp_head() function in header.php file // Load the theme stylesheets function theme_styles() { // Example of loading a custom css file for homepage just on the homepage wp_register_style( ‘custom’, get_template_directory_uri() . ‘/css/custom.css’ ); if(is_page(‘home’)) { wp_enqueue_style(‘custom’); } // Example of loading a main … Read more

The correct way to add a JavaScript in the functions.php [closed]

function my_scripts() { // Register the script like this for a plugin: wp_register_script( ‘custom-script’, plugins_url( ‘/js/custom-script.js’, __FILE__ ) ); // or // Register the script like this for a theme: wp_register_script( ‘custom-script’, get_template_directory_uri() . ‘/js/custom-script.js’ ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( ‘custom-script’ ); } add_action( … Read more

Custom query vars filters problem with pagination

The problem is the pagination parameter in the URL: <a href=”https://wordpress.stackexchange.com/questions/298648/<?php echo (in_array($marca_term->slug, $marca_arg)) ? esc_url(remove_query_arg(“marca’)) : esc_url(add_query_arg(‘marca’, “$marca_term->slug”)); ?>”> Here we see that the marca term is being added and removed, but the pagination parameter isn’t, but that’s a part of the URL not a parameter Instead, why not use the taxonomy archives and … Read more