I need to redirect my store customers to a specific country subdomain for all pages, posts, and products. The main domain and subdomain have the same content, so I only need to change the URL.
For Example: www.example.com main page www.example.com/page1 , www.example.com/product1
For US visitor: us.example.com main page us.example.com/page1 , us.example.com/product1
For US visitor: uk.example.com main page uk.example.com/page1 , uk.example.com/product1
thank you
]]>example request needed would be:
https://examples.com/images/cats/mycat.jpg?format=auto&width=200
]]>public function url_rewrites() {
add_rewrite_rule( 'mailchimp-feeds/content$', 'index.php?orchestrated-mailchimp-integration-template-content=true', 'top' );
}
add_action( 'init', array( $this, 'url_rewrites' ), 10, 0 );
add_filter('generate_rewrite_rules', array( $this, 'url_rewrites' ));
]]>I would like to use this plugin to migrate an oscommerce on a woocommerce but is the link of the product sheet are rewritten ? so this module does it manage the url rewriting ?
thank you
]]> if ( is_array( $brands ) ) {
echo '<div class="filters__brand">
<div class="filters__tab" data-filter-toggle="">
<span class="filters__iden">Brands</span>
<span class="filters__close"></span>
</div>
<div class="filters__itemwrapper">';
foreach ( $brands as $brand ){
echo '<div><a style="color:black" href="' . htmlentities( add_query_arg( 'pwb-brand', $brand->slug, $page_link ) ) . '">' . $brand->name . '</a></div>';
}
echo '<li><a href="' . htmlentities( remove_query_arg( 'pwb-brand', $page_link ) ) . '">None</a></li>';
echo '</div> </div>';
}
if ( is_array( $categories ) ) {
echo '<div class="filters__cat">
<div class="filters__tab" data-filter-toggle="">
<span class="filters__iden">Type</span>
<span class="filters__close"></span>
</div>
<ul class="filters__itemwrapper">';
foreach ( $categories as $category ) {
echo '<li><a style="color:black" href="' . htmlentities( add_query_arg( 'product_cat', $category->slug, $page_link ) ) . '">' . $category->name . '</a></li>';
}
echo '<li><a href="' . htmlentities( remove_query_arg( 'product_cat', $page_link ) ) . '">None</a></li>';
echo '</ul></div>';
} ?>
<div class="productslist__wrapper">
<?php $products = new WP_Query( $args );
if ( $products->have_posts() ){
while ( $products->have_posts() ) {
$products->the_post(); ?>
<div>
<img src="<?php echo get_field('product_gallery')[0]['url'] ?>" />
<h3><?php echo $products->post->post_title; ?></h3>
</div>
<?php }
} else { ?>
<div>
<img src="<?php echo get_template_directory_uri() ?>/compiled/assets/images/no-results.svg" alt="No products found">
<h3>No products found</h3>
</div>
<?php }
wp_reset_postdata();
?>
</div>
This works fine.
However, what I need to achieve is instead of the URL being:
/our-products/?pwb-brand=example-brand
I’d like to use WP’s rewriting functionality to essentially make it:
/our-products/pwb-brand/example-brand
While looking for solutions online, and adding a couple of different rewriting functions to my functions.php file I managed to get my local build to navigate to:
/our-products/pwb-brand/example-brand
But instead of the filtered products being displayed it was rendering all products. So it looks like the filter doesn’t work when using rewrites? I could be mistaken however.
Any help would be appreciated.
]]>First of all thank you for your awesome plugin. I was previously using the native Photoswipe with ACF plugin on my website in order to create a tailor-made gallery but I discovered your plugin and you made my life easier !
I was wondering if you have an idea to customize the urls generated by Photoswipe when triggering the plugin with the data of the current picture like so :
https://www.website/page/theansweris42
instead of
https://www.website/page/#&gid=1&pid=12
It’s not directly related to you plugin but as you may have went deep into Dimitry Semenov work, maybe you have an idea?
Thanks again,
J
I have created a rewrite rule that work fine on a first website.
I have used the same rule on a second website, but instead of rewrite, WP is redirecting…
The main difference between the 2 websites is the second is a multisites. I don’t know if it make a difference for rewriting rules.
Here is my code in functions.php :
function URLbateau( $query_vars ){
$query_vars[] = 'bateau';
$query_vars[] = 'gamme';
return $query_vars;
}
add_filter( 'query_vars', 'URLbateau' );
function rewritebateau() {
global $wp_rewrite;
add_rewrite_rule(
'^les-bateaux/(.*)/(.*)?',
'index.php?pagename=bateaux&bateau=$matches[2]&gamme=$matches[1]',
'top'
);
}
So, when I display an URL like: /les-bateaux/gamme-premium/tarpon-49-qp
I’m redirected to /bateaux/
An idea?
Thanks!
Laurent
/order/(.*?)-([0-9]+)?$
At this page I should display a Elementor widget which will display information about order with given orderId. Whay I reied to do is to create a custom URL rewrite url as follows:
function rewrite_init(){
add_rewrite_rule('/order/(.*?)-([0-9]+)?$', 'index.php?tag=order_page&order_id=$matches[2]', 'top');
}
add_action( 'init', 'rewrite_init' );
function order_query_vars( $query_vars ){
$query_vars[] = 'order_id';
return $query_vars;
}
add_filter( 'query_vars', 'order_query_vars' );
Then in my widget I try to read order_id query var by calling get_query_var(‘order_id’)
But when I try to open page like /order/abc-1234
It just redirects me to the /order_page
My question is are there any ways to define custom query vars for Elementor driven pages?
]]>I want below URL:
https://www.example.com/shop/keyword/
to work as
https://www.example.com/shop/?search_text=keyword
I can achieve this behaviour for my /search/
as below. But this is not working for /shop/
page. What is the way to achieve this ?
function my_rewrite_rule() {
add_rewrite_rule('^search/([^/]*)?','index.php?pagename=search&search_text=$matches[1]','top');
}
but same code is not working for shop page.
]]>