77

Arriving here exactly 2 years after the original question was asked, there are a few things I want to point out. (Don't ask me to point out a lot of things, ever). Proper hook To instantiate a plugin class, the proper hook should be used. There isn't a general rule for which it is, because it depends on what the class does. Using a very early hook like "...


60

Good question, there are a number of approaches and it depends on what you want to achieve. I often do; add_action( 'plugins_loaded', array( 'someClassy', 'init' )); class someClassy { public static function init() { $class = __CLASS__; new $class; } public function __construct() { //construct what you see fit here....


32

Add the filemtime() of your stylesheet as version parameter. Lets say, your default stylesheet is in css/default.css and css/default.min.css (not style.css). When we register a stylesheet on wp_loaded (not init), we can pass a version as fourth parameter. That will be the last modified time and therefore change every time we change the file. $min = ...


12

There are 3 options from easiest --> Use only one remote database that you all connect to with lots of backups. That way you just have to worry about files and not the db. Use the import and export functionality built into WordPress and throw it into your version control right into the wp root (like in a new folder). Sure it takes an extra few minutes but ...


10

I use following structure: Prefix_Example_Plugin::on_load(); /** * Example of initial class-based plugin load. */ class Prefix_Example_Plugin { /** * Hooks init (nothing else) and calls things that need to run right away. */ static function on_load() { // if needed kill switch goes here (if disable constant defined then return)...


10

WordPress as a project has extreme commitment to backwards compatibility. Whatever new things you add the old things need to work still. Whatever things you change still need to work in old way as well. So regardless of how WP started as non–MVC application, it cannot become one without retaining all of its non–MVC ways. Which makes it pretty pointless ...


8

First of all, you need to recognize that there are two workflows here: yours and your client. Your Workflow Receive PSD Code HTML/CSS Code WordPress template Deploy theme to live WordPress site Their Workflow Devise required changes and email you Write posts Upload photos The Issue Implementing version control here has absolutely nothing to do with ...


7

Short Answer Yes. Theoretically any site can be built on top of Wordpress. Long Answer You are going to need a lot of modifications to the standard Wordpress theme. But not to fret I have assembled a list of some of the things that you would need to do to get your feet wet. Add Custom Post Type for Places (Guide | Plugin) Add Custom Meta Boxes for ...


7

After searching for a simple solution many times i decided to find something that works! so... after thinking about it i found a great way to override caching while developing new websites... (and its easy). What we need is to tell wp this is a new CSS version like this... Before changes: wp_enqueue_style( 'maincss', get_template_directory_uri() ...


6

This might seem overly simple, but how about just disabling caching until you're done with the development portion of your site? It's more than simple to turn on and off.


4

I know that this question has had an answer accepted, but I think that that answer is still too complicated for the problem at hand, and may actually be incorrect depending on the user (no offense though), so I thought I'd still share how I bypass caching when I do my dev (not just with Wordpress). Most modern browsers have something called incognito mode. ...


4

You can hook the wp_footer action to output arbitrary JavaScript. This the same action that WordPress uses to output footer enqueued scripts. Here's an example that encapsulates the shortcode, data, and script output in a class: <?php /* Plugin Name: WPD_Example */ class WPD_Example_Plugin { public $data = array(); function __construct() { ...


3

It all depends on functionality. I once made a plugin that registered scripts when the constructor was called so I had to hook it at the wp_enqueue_scripts hook. If you want to call it when your functions.php file is loaded, you might as well create an instance yourself $class_instance = new ClassName(); as you mentioned. You might want to consider speed ...


3

you can achieve the same with out the duplication in two ways: create a custom taxonomy for condition (new,used) use a custom field for condition (new,used) both ways you only need to create each category only once and filter by condition.


3

I would create custom post types and custom taxonomy, taking the standard "Posts" out of the loop. You can then have two separate Taxonomies (Tag systems) for synonyms and antonyms. http://codex.wordpress.org/Post_Types http://codex.wordpress.org/Taxonomies You can then use a plugin like Gravity Forms to have your users register for the site and submit ...


3

I actually use free online development environments to test, such as c9. It allows very quick installation and setup of wordpress. You can easily try different plugins/codes without endangering your files. Moreover, if you mess any thing up you can always delete that installation and create a new one. Another great feature is the cloning of the ...


2

Your fastest approach would be to use a plugin like Easy Google Maps: http://wordpress.org/extend/plugins/wp-gmappity-easy-google-maps/ Based on the features you have listed you would need additional plugins, or--more likely--hire an expert developer to help build the site with these custom features as a new plugin. Allowing users to register is fairly ...


2

Personal recommendations Most important: Don't try to do everything on your own. In most cases it's cheaper and better to donate to open source plugins. to drop your own code and replace it with some open source lib and start contributing there (some have GitHub repos) - I dropped my own set of meta box classes library and now work on Rilwis Meta Box ...


2

If you are comfortable with a source control system such as git - one approach I have used successfully is to create a 'lowest common denominator' theme with all the standard functionality shared between the sites and nondescript styling (black and white, standard reset and typography styles etc). Then to do a new site, branch off from the master branch ...


2

Gosh, many ways to answer this one! First and foremost, you asked about two different things: WP Super Cache and CSS files. These are cached differently, in different places, so it's important to recognize where your problem is. If WP Super Cache, you can define the constant DONOTCACHEPAGE in your functions.php during development to prevent WP Super Cache ...


2

if it is the "Featured Image" of your post, you can use: <?php // check if the post has a Post Thumbnail assigned to it. if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> check: the_post_thumbnail function else if you want to get the first image inside your post, you can use somthing like that: function get_first_post_image() { global $...


2

I think you have outlined a good broad approach, I will break it up into some sub-points for a more specific answer. I also think the important unspoken question here is: "Where do you draw the line between design and functionality?" Because generally speaking, site features, content features and functionality should be kept to plugins and the layout / ...


2

Off the top of my head I can't think of any instance where you would want the WordPress admin to be the main entry point for your website, that there isn't a more suitable software to use. Do you have a specific application or use in mind? In general I would say say, yes it is best practice to keep the admin potion of your WordPress install for "...


2

Out of the box Wordpress uses absolute URLs. This requires you to make database updates when moving sites from development to production or when changing the base URL. I'm not sure why this choice was made but there are many options when moving sites. You can use a tool like WP Migrate DB Pro or another option that will work with serialized data to change ...


2

Since its been so long without an answer I take its already solved, but I'll leave something here for posterity. I run a Multisite to a client at the agency I work for, and the setup is kinda complicated to keep up. They way I see it, the workflow you presented is pretty much spot on. Making it modular makes it safer to maintain, but might create some ...


2

This question actually is a bit too broad. As it would mean to explain you how to develop and deploy a site on your local computer. Which is a pretty opinion-based thing. And which additionally isn't specific to WordPress. But you could simply start to follow this Codex tutorial: Installing WordPress Locally on Your Mac With MAMP or this MAMP tutorial: MAMP ...


1

I have done SymmetricDS synchronization with various content management sites using the wildcard feature to pick up new tables created by custom components. For example, you can put a trigger on tables named 'wp_*' and it will sync any tables that match. You can read about Using Wildcards to Sync Tables for more detail. In one setup, we used a staging ...


1

I usually use the tax_query parameter: $args = array( 'post_type' => 'my_cpt_name', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'uom_system', 'field' => 'slug', 'terms' => 'metric-system' ) ) ); $...


1

While I'm sure there are other tools for this, one specifically that lists importing in/out of Multisite setups is Backup Buddy. It's a great plugin - I'd suggest giving it a look!


1

I imported/exported between a single wordpress blog and a multisite wordpress without problems, many times. Personally on a multi-site wordpress I have a parent generic theme and each website has it's own child theme with as few files as possible, mostly only html/css for custom post types. Security issues or big complicated options are most of the time in ...


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