9

wp_localize_script() calls the method localize() on the global variable $wp_scripts. We can set this variable to an instance of a child class of WP_Scripts: class Filterable_Scripts extends WP_Scripts { function localize( $handle, $object_name, $l10n ) { $l10n = apply_filters( 'script_l10n', $l10n, $handle, $object_name ); return ...


8

Warning: This is just a test for dev installs and not production sites I was curious to see if there was a workaround, for those who want to develope multisites on their dev installs but on different ports than :80 and :443, e.g. :8080. I only found this blog post by Henri Benoit. There he gives examples how to modify the 3.9.1 core, to get around the ...


7

The best way to do it is to use URL Rewrites. This way you'll not have to do any change before uploading CODE to your server back again. Try the following CODE in your .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # custom rules for loading server images or any other uploaded media files RewriteCond %{REQUEST_FILENAME} !-f ...


6

You don't need to add robots.txt file to the root of your site. robots.txt file is generated in real time, when you visit http://mysite.com/robots.txt. The function, responsible for creation of this file, is do_robots. If you wish to add your own directives, just write your hook for robots_txt filter, like this: add_filter( 'robots_txt', '...


6

When WP_DEBUG is set, WordPress sets (via wp_debug_mode() call early in core load process) the error reporting level to E_ALL & ~E_DEPRECATED & ~E_STRICT. This means all warnings and errors except strict errors and PHP deprecated functions (not WordPress ones). You can define your own level in a custom mu-plugin (the override needs to be called as ...


6

Meanwhile, I found some plugins and tools that can help with this: Query Monitor Laps Debug Bar with some add-ons(Slow Actions, Rewrite Rules, etc.) If you really wanna go deep, try using Webgrind. Not the most friendly tool, but it'll do the job. Be aware that some of this tools will also have an impact on performance.


5

Does Wordpress core has this function defined somewhere? While I haven't used it, you are probably looking for wp_salt or wp_generate_password. wp_salt is located in wp-includes/pluggable.php. can these salts be generated randomly Yes, of course. are there any specific rules for creating them There is no specific rule. The generic rule is to create ...


5

You can do it using Widget Context plugin or Widget Logic plugin. They work fine. I prefer Widget Context because it has more flexibility.


5

Drop this in a plugin & activate. I should note this doesn't take into account things like child themes - it's purely for toggling which theme renders based on SOME_FLAG. add_filter( 'stylesheet', 'switch_ma_theme' ); add_filter( 'template', 'switch_ma_theme' ); function switch_ma_theme() { // Return the theme directory name return SOME_FLAG ?...


5

You can't use port 8080. I have no idea why as that is a fairly common port for a web server. However, you can't: 121 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 122 echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install ...


4

Well, after lots of digging (before and after posting this question), I think I figured it out. As @s_ha_dum suggests, the reason behind the odd directory placement is likely a personal preference of the person who created the Ubuntu "wordpress" package. Perhaps it makes for easier partitioning of permissions, or it makes updates more safe (in case the ...


4

It's best to just log errors to the server and then use bash or a server script that supports email and error analysis (instead of PHP). There are lots of log file tools out there, simple ones like Logwatch, Swatch, Octopussy, or more complex ones like Nagios. For errors which are triggered using WP_Error you can write an email alert or log function right ...


4

You must export all table beginning with your WordPress prefix. Open your phpmyadmin panel. Then open your wordpress database. Click "export" from top menu. Select "Export Method:" as custom. Select your all tables beginning your prefix. Then go to bottom of page click "go". You got your SQL file. Move all files to new directory. If you create a new ...


4

I use Dropbox as well, but not directly linked as the Dropbox folder path could differ from install to install. My Dropbox just is the root of my bare git repository. Simplified... When I start coding, I just add a new folder to my Dropbox and --bare init it. // Inside your Dropbox/webdev/themes folder for e.g. git --bare init Then inside your new Theme ...


4

From the WordPress Codex: The secret key is located in two places: the database in case the secret key isn't defined in the second place, which is in the wp-config.php file. If you are going to set the secret key, then you must do so in the wp-config.php file. The secret key in the database is randomly generated and will be appended to the ...


3

If you want sections in a subdomain and in subdirectories, use a multi-site installation. See Create a Network and our tag multi-site. Then you set the the blog and the shop as separate sites, and the portfolio as a custom post type or as a regular page in the main blog.


3

First of all, in order for Wordpress to generate a robots.txt for you you must be using a non-default permalink structure. Make sure you've selected an option in the Settings > Permalinks menu. Also, if a robots.txt file exists at your root directory it will override the setting in Wordpress. It looks like you already have a robots.txt file and that is the ...


3

I created a symbolic link in the /var/www/ directory. ln -s /srv/www/wp-uploads/ wp-uploads and then (in settings-> media) set up the upload folder: wp-uploads and url path: http://<my-ip>/wp-uploads


3

If you are using a twentyten/eleven theme, they hardcode the pingback meta tag into the head.php file. Remove that line or use your own theme. Also, and maybe it's only in multisite, but the X-Pingback header is sent along with the xmlrpc endpoint url as well. Removed with the following: /** * Remove the X-Pingback header, since pingbacks are disabled */ ...


3

Well, someone has to be hosting it, so I recommend tracking them down. I've taken the liberty of doing this for you (using WhoIsHostingThis?). Your host is IX Web Hosting, contact their customer support and see if you can either get them to do the upgrade for you or, preferably, get them to give you admin access to your site.


3

Not exactly what you are asking for, but very close. There is a concept of 'dropin' plugins that exists primarily to override or add to core functions The dropins will always load. So one ftp's up wordpress including whatever plugin files you want that will create your default environment. These should be in the top level wp_content folder. I have one ...


3

What about using something simple like a plugin. I'm using Widgets Controller and it's a good one. A plugin that give you control for show or hide widgets on WordPress Categories, Posts and Pages.


3

You should make a plugin, that way it is portable to any theme. Generally speaking people need to stop filling up functions.php or theme files with code that is better suited for scalability and flexibility, aka a plugin.


3

@toscho great implementation. Tested and true. Here is a slightly modified version, which also passes the $handle and $object_name so you can filter only when needed. class Filterable_Scripts extends WP_Scripts {     function localize( $handle, $object_name, $l10n )     {         $l10n = apply_filters( 'script_l10n', $l10n, $handle, $object_name );         ...


3

You can change that in wp-config (https://codex.wordpress.org/Editing_wp-config.php#Empty_Trash): define( 'EMPTY_TRASH_DAYS', 1 ); // Integer is the amount of days


2

After reading several topics about this issue I've found this: Issues with old WPMU installs If you installed WordPress MU in subfolder/subdirectory (not in root folder on your server >via ftp) and you have problem with image library, where thumbnails and images do not show, >you may need to manually add in rewrite rules for your file directories as ...


2

Add the following to wp_config.php: define( 'WP_DEBUG', true ); Reset the Plugins folder Revert to the default Theme (currently Twenty Eleven), using a similar method to the Plugin-reset step (just be sure that the only Theme available in /wp-content/themes/ is twenty-eleven) If your site is restored, great! If not, you likely have some sort of server or ...


2

What permissions should I set on each of wp folders? Users will need to upload various assets (images, pdfs, office docs, audio, video). I found this article here that seems helpful, but would like to get some input from folks having done this? This will be the same as any other web server. Whatever user happens to be running the web server need ...


2

This plugin http://wordpress.org/extend/plugins/wp-page-widget/ is very good and here're some screenshots and more info about it http://codeandmore.com/products/wordpress-plugins/wp-page-widget/. Used it on quite a few sites and never had any issue. The best thing about it is that you can actually manage the widgets for each specific page on the page's ...


2

What I have seen in translation plugins (qTranslate, WPML, Multilingual Press) are two approaches. One is qTranslate's (and the defunct xLanguage): use one field (one for title, other for content, etc) to hold all translations. And then, in the front end, decode its output according to the actual language. <!--en-->English<--:--><!--es-->...


Only top voted, non community-wiki answers of a minimum length are eligible