/wp-admin/admin-ajax.php?action=generate_wpo_wcpdf&document_type=invoice&order_ids=11228&order_key=wc_order_AH9JQsGTJmnOH
]]>Qtranslate has an option “Hide content that is not available for the selected language”, but it does not apply to the get_sites function ….
Getting all blogs at the moment looks like:
$sites = \Timber\Timber::get_sites();
$context['cities'] = array_map(function ($site) {
$city['name'] = $site->name;
$city['link'] = $site->siteurl;
return $city;
}, $sites);
I would be glad for any help …
]]>The other day I was faced with the task of displaying posts from one blog in another.
The output is customized by permalinks.
I have a registered custom type. Entries of this type are output through single.php. By checking query_vars, if necessary, there is a switch to the desired blog to pull the entry.
All metadata can be retrieved without problems in this way. But there are a number of problems:
1) 404 status is transmitted in headers. I change the status to 200 when there is a missing post on the current blog.
2) AIOSEOPack does not work for this entry. Data for 404 status is taken.
Any ideas how I can get this to work correctly?
My post type:
register_post_type( 'quest',
array(
'menu_icon'=>'dashicons-tickets-alt',
'labels' => array(
'name' => __('Quest', 'questhunter'),
'singular_name' => __( 'Quest', 'questhunter'),
'add_new' => __('Add new quest', 'questhunter'),
'menu_name' => __( 'Quests', 'questhunter')
),
'supports'=> array('title','editor','thumbnail','page-attributes','comments'),
'public' => true,
'publicly_queryable' => true,
'hierarchical' => false,
'taxonomies' => array( 'category' ),
'has_archive' => true,
'rewrite' => array(
'slug' => 'quests'
),
)
);
Template rules and redirect
function custom_add_rewrite_rules() {
global $wp_rewrite;
add_rewrite_tag('%from_blog_id%','([^&]+)');
// add_rewrite_tag('%external%','([^&]+)');
add_rewrite_rule(
'^external/([0-9]+)/([a-z-]+)[/]?$',
'index.php?post_type=quest&from_blog_id=$matches[1]&name=$matches[2]',
'top'
);
// add_rewrite_endpoint( 'external', EP_PERMALINK | EP_PAGES );
$wp_rewrite->flush_rules();
}
add_action('init', 'custom_add_rewrite_rules');
add_action( 'template_redirect', 'unlisted_jobs_redirect' );
function unlisted_jobs_redirect($template)
{
// check if is a 404 error, and it's on your jobs custom post type
if( is_404())
{
$blog_id = get_query_var('from_blog_id');
$postname = get_query_var('name');
if ($blog_id) {
switch_to_blog($blog_id);
global $wp_query, $post;
$new_wp_query = new WP_Query(
array(
'post_type' => 'quest',
'name' => $postname,
'from_blog_id' => $blog_id,
'quest' => $postname
));
if (!empty($new_wp_query->posts)) {
$wp_query = $new_wp_query;
header("HTTP/1.1 200 OK");
}
restore_current_blog();
}
}
}
]]>I have a multinetwork site setup and woostores running on all sites. Now, when I update woocommerce on main site, I need all of my subsite’s databases to automatically update.
Is there a way to automate this process?
]]>This is how I want my network to be designed …
mycompany.com
… city1.mycompany.com
… city2.mycompany.com
… city3.mycompany.com
Now basically I will use my theme for all city subdomains, but the only problem is that my theme does not support woocommerce … please don’t explain how i can manually add support for it, I have tried this and it just doesn’t work well and displays weird …
So i would like to install woocommerce on a subdirectory of the city subdomain so that I would be able to use the woocommerce theme in the subdirectory as such …
mycompany.com
… city1.mycompany.com/shop
… city2.mycompany.com/shop
… city3.mycompany.com/shop
Is this possible and how would i set it up?
Thanks
]]>I am starting a company that will eventually have sites for different cities, for example …
MY COMPANY
-Savannah site
– Charleston site
– Atlanta site
– Jacksonville site
– Orlando site
And each city site will have a separate sub-domain (or so i assume I should set it up as) for the retail side of the site.
So the main city site will be the main page where visitors can interact with the site, but when they want to buy merchandise from the site, they actually buy it from the retail page for the site (which will be very big and have more pages than the main site) which will be on the sub-domain of the city site such as www.shop.savannahsite.com.
Does this sound like a good way to setup my network?
I should also mention that for now, since I am just starting out, I will only be building one city site (savannah) and its shop page (shop.savannahsite.com). And the other city sites will come later, or once I perfect the savannahsite I would want the other city sites to be identical to the savannahsite but obviously with content and merchandise tailored specifically to each city. Would I be able to just clone the first savannahsite and then just change the site name and content, etc.
Thanks so much.
]]>