Tag Info

Hot answers tagged

10

If you must hack core, consider doing so in a way that makes it extensible for others. Add an Action Hook Nine times out of ten, you could do what it is you wanted if only there was an extra do_action call in a specific file. In that case, add the action, document it, and submit a patch via Trac. If there's a good reason for your patch (i.e. you're not ...


7

This makes not that impressive answer, but - none. get_ is suffix usually means function returns something, the_ that function echoes something. wp_ doesn't carry technical meaning and inconsistency in naming is from many developers participating and lack of movement to unify (moving forward is considered more important than major cleanups of older stuff ...


7

The active plugins are stored in the 'active_plugins' option, like this: array( 'akismet/akismet.php', 'hello-dolly.php', ); On each page load, WP just loops through that array and includes those files. It's up to each plugin to include any additional files that it may have. When a plugin is deactivated, it's just removed from that array. On the next ...


6

The easiest way to create a patch is described here: http://wordpress.org/download/svn/ Can I create patches from older version or must I use trunk? You should create the patch against the same version you want it applied against. In other words, don't expect a patch created against WP 3.0.1 to apply cleanly on WP 3.1-alpha. If I'm working on a ...


5

Eclipse PDT + Subclipse + X I'm using Eclipse that has SVN Integration. I think PHP Strom does so as well. I go into one of my trunk projects which are basically a checkout from WordPress svn repository. Then I edit the files I need to edit. Eclipse shows which are modified, I right-click a directory, select Team->Create Patch and I get offered all ...


5

I believe it was added back on WordPress 2.6 (maybe 2.5). It's there to allow you to set a maximum width on images being displayed as content in your theme. E.g. If your main content area is only 475px wide, you could set $content_width = 450 to make sure your image doesn't break out of your main content area.


5

Pull down the copy of Wordpress from your client's server to your local. Download a clean zip of the version of Wordpress your client has installed. http://wordpress.org/download/release-archive/ From there, you will need to use a file comparison tool (i.e. Diff on Linux). You can also use GIT to find the difference in folders by creating a GIT repo of the ...


5

More than an Answer, this is a research and a compilation. Database Description already in Damien answer. A Google search reveals this in WordPress forums: UML documentation of WordPress As far as I know, that's all we have. If you want to write one, I'm sure it'd be welcomed :) (Ipstenu, referring to the Database Description) UML of ...


4

I'm not sure if all of these are WordPress globals, but i did a quick grep type search of the WordPress files and tried to extract all the globals i could.. This is a list i compiled for you, that may not be perfect, but should *hopefully* represent alot of the $GLOBALS keys that WordPress uses, it won't account for globised variables that aren't explicitly ...


4

The "Log In" string is passed to the translation function, and you can filter that. To prevent needing to filter every little string, you can activate this filter right before the login form is printed. add_action( 'login_form', 'wpse17709_login_form' ); function wpse17709_login_form() { add_filter( 'gettext', 'wpse17709_gettext', 10, 2 ); } function ...


4

You can hook on option_update_core and edit the update url, as a plugin you can do something like this (Remember to disable the plugin after updating wordpress) add_filter('option_update_core','wpse_26750'); add_filter('transient_update_core','wpse_26750'); function wpse_26750($options){ global $wp_version; $updates=array( ...


4

If you are looking for the database schema, there is a version on the Codex: click to enlarge The image you referenced in your post is the template hierarchy most commonly used by theme developers.


4

There is get_core_updates(). Note that you might need to manually include admin file that declares it, if running in front end and such. Example use: require_once ABSPATH . '/wp-admin/includes/update.php'; print_r( get_core_updates() ); Example return: Array ( [0] => stdClass Object ( [response] => latest ...


4

Files named "core" are created when some OS process crashes. In your case it was likely a crash of the php interpreter. These files being memory dumps are used to debug the process "postmortem" - e.g. to check in which function did it fail, so it is perfectly safe to delete them if you are not going to debug the issue. In fact, on many systems there is a ...


4

Your .htaccess lines need to look like this: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) /wordpress/wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] ...


3

To add to what Brain said, I think using a visual IDE that shows git/svn changes helps a lot, and also allows you to save all the changes. Here is a screenshot of what a git compare looks like in netbeans 7.0. ( the git integration is still new but so far seems to work quite well). It works with SVN, CVS, and Mercurial too.


3

The $post->filter contains the context under which the contents of the post have been filtered. Context could be something like "display" indicating the post is meant to be displayed on the page. This is done by the sanitization functions, to indicate under what context the post data was sanitized. Different contexts get different types of sanitization. ...


3

There's not a constant or anything there, but you can install the WP Beta Tester plugin to switch your update stream to the latest nightlies. Once you install this plugin, you can automatically update to the latest "bleeding edge" release from the standard update panel. Just remember, it's not advised to update production sites to the latest nightly build. ...


3

Somewhat related: I don't know if it's reasonable to use $content_width if you plan on developing a theme that allows flexible design options. For example, let's say that your #content will be set to 512px if a user has sidebar widgets active and 768px if a user has no sidebar widgets active. I see no reason why CSS isn't enough to handle image overflows in ...


3

Yes! Orangelab has built a plugin which can replace WP's use of GD with Imagemagick (provided it's already installed on your server - it's not included) for creation of all image sizes and thumbs, and even regenerate existing images too! For anyone who cares about image fidelity, this is huge deal, as GD does not handle color profile preservation or ...


3

Editing core is extremely bad practice. At best you will break updates, at worst random thing would be completely broken all over. See Steps to Take to Hide the Fact a Site is Using WordPress? for better alternatives.


3

First should only disable SQL_CALC_FOUND_ROWS if you aren't using pagination, to do so set parameter no_found_rows to true in WP_Query. WP_Query( array( 'no_found_rows' => true ) ); Note get_posts() does that by default.


3

Those are javascript templates that get compiled into HTML by a javascript library. I think WP uses underscore.js. Let's say you write a jQuery plugin, and you have to append HTML code to the document. Using such templates you can avoid stuffing that HTML code inside huge concatenated strings within your javascript code, and put it where the other HTML ...


3

Install my plugin T5 WP Load Order. You get a long detailed list with all available hooks, files, constants, classes, functions and global variables – ordered by first appearance. Whenever you’re in doubt create such a list for the page you are working on, and look up what you need.


2

I can only answer your first two questions as I do not know anything about multisites. The default comment and content in the 'About Us" page is not coming from the theme files, but rather the database. They are the default posts/pages/comments accessed by the backend not by the theme files. To get to this content and replace it login to the admin via ...


2

So the solution to the get_comments_pagenum_link() function is straightforward enough: add_filter('get_comments_pagenum_link' , 'new_get_comments_pagenum_link'); function new_get_comments_pagenum_link($content) { $content = str_ireplace('#comments' , '#other', $content); return $content; } Which filters the output of get_comments_pagenum_link() to ...


2

Hi @Dwayne: I'm not 100% what you are asking, it seems like several questions? But here goes: $meta_value = get_user_meta($user_id, $key, $single); For example: $first_name = get_user_meta($user_id, 'first_name', true); As for adding hooks I think this answer might be what you are looking for? How To Add Custom Form Fields To The User Profile ...


2

WordPress has a feature built into it to do updates and upgrades. Are you currently using an older version of WordPress that doesn't have this feature? As Rarst wrote, you don't need to worry about the database updates. Both WordPress and plugins will upgrade the database entries and schema automatically, when you first load the administrative console after ...


2

$content_width is used for limit the image width in post content. It will overwrite setting in Media section for large size. If you define this variable in functions.php file, then the width of large size of uploaded image will be $content_width. Here is a post about this.


2

Wordpress was and is written by a lot of different people. Patches are discussed inside wordpress trac and whoever submits or assigns to a trac ticket can post patches. If the patch gets accepted and moved into core of an upcoming version it's simply in there. So sometimes functions, vars, etc. gets the prefix while other times they don't. It relies on the ...



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