plugins_url not returning correct directory
plugins_url not returning correct directory
plugins_url not returning correct directory
WC()->plugin_url() is basically a wrapper for the core function plugins_url(). That functions return value is filtered. return apply_filters( ‘plugins_url’, $url, $path, $plugin ); So you should be able to add a filter to that hook that returns the initial value if $plugin isn’t woocommerce, then checks if the path or URL leads to one of … Read more
You are overkilling the idea of the query to get the url. The simplest way and best way at the same time is: <?php // get_the_ID() will return the current’s post id // get_the_permalink() will return the current url $current_url = get_the_permalink(get_the_ID()); ?> That function will not echo, but rather return/get the permalink url for … Read more
Fail on admin_enqueue_scripts when I try it to upload a CSS file to my WordPress Plugin
Create a custom page template: <?php /** * Template Name: Random PHP */ get_header(); //add random PHP get_sidebar(); get_footer(); ?> Create a page in WordPress, give it the title portfolio. In the template select box choose Random PHP
You could try something like if( ! function_exists(‘plugin_function’) ) require_once(‘/wp-content/plugins/wp-recaptcha/recaptchalib.php’); endif; Not tested but essentially it checks if the plugin exists before trying to add it
This line is your problem: $new_site_name = $site_name . ‘<sup>echo ‘<img src=”‘ . plugins_url( ‘images/wordpress.png’ ,”logo.jpg” ) . ‘” > ‘</sup>’; Here you’ve muddled up the quotes and put PHP code inside a string expecting it to still work. e.g. echo ‘ this is inside a quote:’ inside a quote ‘ . ‘; It doesn’t … Read more
Since I was able to find a solution, I am answering the question myself. Unlike what I have read elsewhere, it is indeed possible to place wp-content outside of the document root. Open basedir needs to be disabled, and the path to the new folder needs to have sufficient permissions. Concerning the issue with custom … Read more
First you need to register your expected variables. Something similar to: function my_rewrite() { add_rewrite_tag(‘%ct_city%’, ‘([^&]+)’); add_rewrite_tag(‘%country%’, ‘([^&]+)’); } add_action(‘init’, ‘my_rewrite’, 10, 0); Then you need to create the rule which will redirect to your abm page. Note that you will need to discover your abm‘s ID, since you will need to pass it in … Read more
Just don’t do it, you can never know if the plugins directory is even “below” ABSPATH, and you can not know the URL out of the directory path https://codex.wordpress.org/Determining_Plugin_and_Content_Directories. Just use the core api of plugins_utl etc, don’t reinvent the wheel.