Alias ‘wp-content’ directory to something shorter (framework?)

I recall seeing this as a feature of a WordPress Development Framework, so I know it’s possible (can’t remember the framework). I am interested in how to condense the WordPress-generated urls to something more concise and not so “WordPressy”. I’m thinking that I would have to both update the .htaccess and add some kind of … Read more

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: http://www.domain-name.de/images/image1.jpg Right now, they are … Read more

How can I get a link path to use for my resources such as JS scripts?

Is there a function that would return the equivalent of plugin_dir_path but it being agnostic of a plugin / theme? JS scripts need to be enqueued as resources, as such, you cannot include their on-server path which is, say /var/www/html/wordpress/thing/thing2/script.js, it needs to be the http://www.example.com/thing/thing2/script.js counterpart. 3 Answers 3 This is kind of a … Read more

Get uploaded image url

I am working on a plugin that constructs a newsletter witch uses a template with a few images. The images have been uploaded using the Media Library (uploads/current_year/current_month/) and I want to get the images URL by using the image name. Any way of doing this without iterating over all the images? I have tried … Read more

Programmatically add a custom page/path/url/route to WordPress

Conceptually what I want to do is super simple. In my plugin, I want to add a single path/route to my wordpress site: [mysiteurl]/testpath … that loads a particular file, like: [filepath-to-my-plugin]/testfile.html I have played with wp-rewrite, flush_rules, add_filter(‘rewrite_rules_array’, xxx), but all I got was for the site to accept the path but display the … Read more

Wrong path for theme assets

I’m working on a WordPress project, starting from Mark Jaquith’s WordPress-Skeleton repository, using MAMP. I cloned the repo, updated the WordPress submodule, created a database and updated the local-config.php file. Everything seems to be fine so far, but when I try to use a different theme (placing it on /content/themes), all the theme’s assets get … Read more

Plugin base URL

In a question that is related to, but not the same as, How to link to images in my plugin regardless of the plugin folder’s name plugin-folder/plugin-main-file.php plugin-folder/images/ containing all images plugin-folder/classes/ containing class definitions plugin-folder/classes/class1-files containing additional files for class 1 plugin-folder/classes/class2-files containing additional files for class 2 etc To access images, I can … Read more

ABSPATH not working! Any idea why?

This is what in my wp-config.php : if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . “https://wordpress.stackexchange.com/”); 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 … Read more