bloginfo(‘template_directory’) img src

I am lazy loading some images with URLs which are added via custom fields. The lazy load plugin I’m using requires a place-holder image in the src attribute and the actual image in data-original. http://www.appelsiini.net/projects/lazyload I need the image height and width as well, so I’ve been using wp_get_attachment_image_src(). My problem is using bloginfo(‘template_directory’) to … Read more

Is it good security advice to install wordpress in subdirectory but link to root?

Is it good to install wordpress in a subdirectory (with a random name), but set “Homepage” address to domain root? (based on Giving WordPress Its Own Directory) Since the wp-content is in the subdirectory and every link to photos and other files (including plugins css and js) in homepage, includes the full path of content … Read more

How to get the current plugin name?

I need to get the current plugin name using a define like this define(PLUGIN_NAME, plugin_basename(dirname(__FILE__))); Regrettably, that code doesn’t work because the php file is nested inside a subdirectory (includes) of my plugin directory and it returns my-plugin/includes Is there any function from WordPress API to accomplish this task? Thanks in advance. 3 Answers 3 … Read more

Installing multisite on domain with existing subdirectory wordpress installations

I have a domain that already has a number of wordpress installations in existing subdirectories. I would like to activate wordpress multisite to manage so new subdirectory installations with a new template. The concern I have is that on activating multisite it’s prompting me to clear all database tables for the existing installation. Will this … Read more

Can I put my WordPress theme files in another folder?

Currently my folder structure looks something like …\themes\MyTheme – \lib – \src – index.php – style.css – more theme files – .gitignore – README.md – many other non-Wordpress files I’d like to change it into something more like …\themes\MyTheme – \lib – \src – \wp – Pretty much all my theme’s .php files – .gitignore … Read more

get_template_directory has an odd functionality

I have WordPress 4.4 installed localy on wamp server 2.5 x64 on Windows 10 and noticed that: get_template_directory(); returns this: ‘C:\wamp\www\my-site//content/themes/my-theme’ Questions What’s the reason for those two sequential slashes, if this is not a bug? Why WordPress does not handle DS correctly (regarding slashes and backslashes)? is this something up to the web server … Read more

Include file from higher level

I created a custom page template where I want to present some data specific for that page. The file is placed in wp-content/themes/themename/page-templates In that file I want to include another php file from the parent directory. That file is placed in: wp-content/themes/themename So in the file i write: <?php include(‘../Sorting.php’);?> But I receive an … Read more

Suppress subdirectory from WordPress Multisite primary URL

I just installed WordPress Multisite (version 4.7.2) in a subdirectory of my primary domain (site1.com/wordpress), and I’ve configured multisite to use subdirectories for all other sites. I understand that WordPress will not allow a change to the primary site’s URL to remove the /wordpress portion of the URL because of how it handles permalinks. But … Read more