Articles of paths

plugins_url function mixes system path and URL

In my WordPress widget I use the following code: wp_register_script(‘jquery-ui.widget’, plugins_url(‘assets/js/jquery-ui-1.9.2.widget.js’, dirname( __FILE__ ))); Unfortunately, the code gives me an invalid URL which is mixed with my system path: Is this problem maybe related to the fact that I have a local WordPress installation running on a Windows computer (with Apache 2)?

Components used in Themes and Plugins: How to get file URL?

In my projects I have some components which I use in a lot of custom Plugins as well as in some custom coded Themes like e.g. admin image or video selectors. Those I am holding in custom git repositories. However as those components are used in both – themes and plugins – I always have […]

WP Paths in a Plugin – how to include

I’m working on my first WP plugin, and I’m having trouble getting a file include to work. My directory structure looks like this: myPlugin classes templates css js myplugin.php My main plugin file (myplugin.php) includes / requires various files in the classes directory, and that works fine. However, one of the files in the classes […]

Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint

<?php echo plugins_url().’/jamesplugin/assets/library/classes/process_mailchimp.php’;?> The above is path of a file that is kept in a plugin, but I want to transfer that file to a theme say here → inc/process_mailchimp.php For this plugins_url() what will be its theme-equivalent? Please let me know If I need to provide any extra information to you.

Problem with loading images from child theme CSS file with relevant path

I am getting an issue with loading relevant images within CSS file from a child theme directory. I placed – Sites: OR body{ background-image: url(/wp-content/themes/child-theme-name/images/some-image.png); } Now the above works fine when the site is in the root folder (or sub-domains) but the path breaks when the site is from a sub-directory installation. […]

issues including a file from a plugin directory

I have a processForm.php in theme directory that does what it says. I am trying to include a file (which i need in order to run a specific function in processform.php) from a plugin directory and have been unable to do so. As suggested in first solution in this thread I tried : include( plugin_dir_path( […]

ABSPATH not working! Any idea why?

This is what in my wp-config.php : if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . ‘/’); I am calling from plugin/pluginName directory to : require_once( ABSPATH . ‘wp-includes/user.php’); But it is returning: Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/——/wp-content/plugins/—/—.php on line 43 Fatal error: require_once() [function.require]: Failed opening required […]

Change path of the page's template

It’s possible to create templates for pages with that: <?php /* Template Name: Contact */ ?> This templates are located on the theme folder, right? Is possible to change the default path where WP search for those templates? If I want to make a lot of templates, can I create a folder to put them? […]

Retrieve Path of admin.php

Is there a better way of retrieving the path of admin.php and the url of wp-admin.css? What I can think of is: $adminphppath = ABSPATH . ‘\wp-admin\admin.php’; $admincssurl = get_bloginfo(‘wpurl’) . ‘/wp-admin/css/wp-admin.css”; But, some may be changing the admin path for security. So I need a more reliable way. [Edit] I need the system path […]

Remove 'wp-content/themes/themename/' from Image path

I’m currently moving an old website based on some other CMS towards a new server, with WordPress. However, the site ranks good on Google, and I’m have to keep all the link structure, including the ones from images. So, in the old CMS, the links to images were like this: Right now, they are […]