Articles of plugins url

How do I link an image in my plugin so it displays on WordPress?

I’m creating a plugin for a college project. The plugin is very simple: it searches for name of the site address and upon finding it in a post, it outputs the site address with an image. However, I cannot get the code working. I’ve tried this: <?php /* Plugin Name: Murtaghs Trademark Plugin Plugin URI: […]

add custom entries to menu options

The menu options in WP already have support for created native posts types, and custom post types, and existing taxonomies. But in my plugin I provide a couple custom URLs that are not associated with any post object. E.g. will list all the entries for a particular CPT with certain values set in postmeta; […]

Sharing the wp-content folder over different WordPress multisite installs

I have four different WordPress multisite installs which I would like to keep separate for good reasons, but I would be happy if I could share at least some of wp-content. Is there a clean way to get this done? I tried putting these in wp-config.php: define(‘WP_CONTENT_DIR’, ‘/home/shared_root/public_html/wp-content’); define(‘WP_CONTENT_URL’,’’); I quickly learned that sharing the […]

Add URL Rewrite Rule To WordPress

my link http://localhost/abm/?ct_city=la-jolla&search-listings=true i want to this http://localhost/abm/USA/la-jolla Could you help please.. htpaccss file # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /abm/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /abm/index.php? [L] </IfModule> # END WordPress

php – Plugin/theme relative PATH/URI

I would like to get relative path from a php file without knowing the absolute path. I have succeeded to do it but for a reason which I don’t know, on some servers (in rare case) it doesn’t work when I enqueue css/js. Slashes are missing… Here the code: define(‘PATH’, trailingslashit(str_replace(‘\\’, ‘/’, dirname(__FILE__)))); define(‘URI’, site_url(str_replace(trailingslashit(str_replace(‘\\’, […]

404 when enqueue_script using plugin_url

So i’m adding a script into my site via functions.php that lives in the plugins directory. The code is pretty straightforward: function add_jq_script() { wp_register_script(‘r_footer’, plugins_url(‘/responsiveFooter.js’, __FILE__), array(‘jquery’),’1.1′, true); wp_enqueue_script(‘r_footer’); } add_action( ‘wp_enqueue_scripts’, ‘add_jq_script’, 999 ); the plugins seem to be working on local site, but in dev console, i’m getting a 404 that seems […]

URL rewriting for WordPress Network (Multisite) subsite

We have an install of WordPress Network (Multisite) that has multiple blogs running under the url where each subsite is /site2 etc… We have a user that already has a URL ( and would like to keep his URL but also use our install of WordPress. Can this be done with any settings […]

check if a file in a plugin folder exists from a locale installation

I need to check if a file exist in my plugin dir: if (fileexists) { … } else { … } However, if in place of fileexists I use file_exists(WP_PLUGIN_DIR . “/myplugin/myfile.ext”) it returns always true, whereas if I use file_exists(plugins_url( “myfile.ext”, __FILE__ )) it returns always false, irrespective of the argument I use is […]

What's wrong with my use of plugin_url()?

I keep getting the following message in the browser Fatal error: Call to undefined function plugin_url() in My code at present: add_action( ‘wp_enqueue_script’, ‘load_jquery2’ ); function load_jquery2() { wp_enqueue_script( ‘jquery’ ); } function add_my_css_and_my_js_files(){ wp_enqueue_script(‘jquery-validate-min’, plugin_url(‘/activate/jquery_validate_min.js’, __FILE__ ) ); } add_action(‘wp_enqueue_scripts’, “add_my_css_and_my_js_files”); The plugin is in a folder called ‘activate’ & the JS is in […]

Access bloginfo, get_option, and plugins_url from a non-core php file

I am creating a plugin that has a php file in the plugin directory which is accessed directly via a custom rewrite url. I need this file to be able to use the three functions mentioned in the title. At the moment, I am including the wp-load.php file which gives me access to all of […]