display merged posts from multisite and sort by latest date

The solution (with template parts): $blogs = array( 1,4,5 ); $all_posts = array(); foreach( $blogs as $blog ) { switch_to_blog( $blog ); $args = array( ‘category_name’ => ‘noticias’, ‘posts_per_page’ => 2, ‘orderby’ => ‘publish_date’, ‘order’ => ‘DESC’); $blog_posts = get_posts( $args ); foreach( $blog_posts as $blog_post ) { // Correct permalink, blogname, blog url and … Read more

Manipulate list of themes in wp-admin

Probably not without editing core files. I haven’t found any hook you could use. If you look in the file wp-admin/themes.php and follow the program flow until the list of themes will be displayed, you can find the class WP_Themes_List_Table in wp-admin/includes/class-wp-themes-list-table.php. This class generates the HTML list. Following the prepare_items() method, WordPress get the … Read more

Getting an ERROR: Cookies are blocked error when logging in to a site on a different domain?

The problem was I had the old multi-site method, which used sunrise.php. I removed wpcontent/sunrise.php and the SUNRISE setting in wp-config.php I then added the relevent settings from the accepted answer on a similar question and it worked. define(‘ADMIN_COOKIE_PATH’, “https://wordpress.stackexchange.com/”); define(‘COOKIE_DOMAIN’, ”); define(‘COOKIEPATH’, ”); define(‘SITECOOKIEPATH’, ”);

Set multisite settings when new site created

install.php is only run during installation, it wont be run during new site creation. You’d need to put that code in a mu-plugin to have any chance of running. (I guess it could also exist in a network-activated plugin, but I’m not 100% sure of that) Add the following before your code, and put your … Read more

favicon and multi site

I would use a rewrite to map requests for /favicon.ico to /icons/example.com.ico: RewriteCond %{REQUEST_URI} ^/favicon\.ico RewriteCond %{SERVER_NAME} ^(www\.)?([a-z0-9]+) RewriteCond %{DOCUMENT_ROOT}/icons/%2.ico -f RewriteRule . /icons/%2.ico [L] Note the regex for line #2 depends on your set-up – is each website its own domain, or a subdomain/subdirectory of a primary domain? I would also place a default … Read more

How to move theme directory but not plugins/uploads out of WordPress root directory?

http://codex.wordpress.org/Function_Reference/register_theme_directory /** * Register a directory that contains themes. * * @since 2.9.0 * * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR * @return bool */ function register_theme_directory( $directory ) You should be able to call register_theme_directory(‘/full/path/to/directory’) and thus add a new path full of … Read more