I have a WordPress multisite with one main site and four sub-sites. In a PHP template on my main site, I would like to get the posts from one of the sub-sites and print the permalinks to the page. How is this done? My code is below--when this code is executed, permalinks are indeed printed to the screen, but they are incorrect--the post name is correct, but the path is incorrect. $tp_blog_id = 4; switch_to_blog( $tp_blog_id ); $posts = get_posts( …
I try to add addtoany shortcode in my custom loop page but the shared link stays always the same for each posts in the loop. <?php global $post; echo do_shortcode('[addtoany url="' . the_permalink() . '" title="' . the_title() . '"]') ?> I also tried with get_permalink(), get_permalink($post->ID), get_the_permalink()... but nothing works. It should work like this, according the official documentation. I don't understand why :/ EDIT Here is the full function: <?php add_filter( 'generate_do_template_part', function( $do ) { if ( …
I'm using this function to switch to my main website's navigation and display it on all sub sites in my multisite network. Ideally the links should have the following format: http://www.mysite.com/navigation-link but on the sub-sites the urls are http://www.mysite.com/subsite/navigation-link Obviously these pages don't exist so it's just showing a blank page. Any idea how I could make sure the urls are like the first example and how I might incorporate that into my function? function wp_multisite_nav_menu() { global $blog_id; $args …
I'm trying to troubleshoot a wide-scale problem. I'd like to rewrite default WooCommerce permalinks for categories, to delimiter as commas. Let's take an example: Brand Model Generation Engine Product The permalink structure I'd like to have: /chip-tuning-Ford /chip-tuning-Ford-Focus /chip-tuning-Ford-MK3-FL /chip-tuning-Ford-MK3-FL-1.5TDCi-75kW /chip-tuning-Ford-MK3-FL-1.5TDCi-75kW-Basic-Box I did this via generate_rewrite_rules action, but currently, we have about 4000 categories and 9000 products, so each combination takes a lot of time and space. All rewrite rules by WP default are saved into one field on the …
The URL structure I am hoping for is as follows: All posts: /blog/ and /blog/page/2 Categories: /blog/%category%/ and /blog/%category%/page/2 Post: /blog/%category%/%postname%/ Tags: /blog/%tag%/ and /blog/%tag%/page/2 My problem is that I am unable to have both my permalink 'custom structure' and 'category/tag base' with the "blog" prefix, without having page or pagination 404 errors. I am working on a dev site which has no plugins and a custom theme which is not ineterferring. I would like a plugin-free solution which is …
i have enable permalinks on my wordpress site and now every page returns 404 error. The site is hosted in IIS 8.5 the web.config file has the following rule inside <?xml version="1.0" encoding="UTF-8"?> <directoryBrowse enabled="false"/> <rewrite> <rules> <clear/> <rule name="wordpress" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> what can i do to fix that and make permalinks work?
Hi I'm new to WordPress hence if my question was simple or stupid I'm sorry, but please someone tell me how to change URL for pagination pages. Currently I'm having URL for pagination pages as: www.example.com/category_name.html/1 www.example.com/category_name.html/2 www.example.com/category_name.html/3 etc. But I need to change this URL structure as: www.example.com/category_name.html?page=1 www.example.com/category_name.html?page=2 www.example.com/category_name.html?page=3 etc. I tried something like this but it's not working. add_action( 'init', 'add_author_rules' ); function add_author_rules() { add_rewrite_rule( "bycategory/108-abodes-of-vishnu)/?$", "category_name=$matches[1]&paged=$matches[2]", "top"); } Any help would be greatly appreciated.
I added this code to my .htaccess file to get rid of index.php, but now all the pages 404 (the hyperlinks are mapped to the correct url) # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress i set up my permalinks using http://1.1.1.1/%postname%/ what are the next steps in order to troubleshoot this issue? what is the default permalink for me to …
I'm using WordPress Twenty Sixteen theme. Now I've a menu item named Product and it has a sub menu. The product page has a permalink as usual, but I want to remove it i.e., when I click on this menu item, it shouldn't perform any action, just like clicking on a text. However, it should not lose its hover color while doing so. I found a solution pointer-events: none, but it removes the hover color. I don't want to use …
Can this function... function custom_pagination_base() { global $wp_rewrite; $wp_rewrite->pagination_base = 'p'; $wp_rewrite->flush_rules(); } add_action( 'init', 'custom_pagination_base' ); ...be somehow used to change the from of the url from "page/2/" not to "p/2/" but to "?p=2"?
I'm recently added this code to my Wordpress website to add .html for my product category. It worked okay with the category (http://mywebsite.com/parent-category/product-category.html) but when I clicked the pagination, the link turned into (http://mywebsite.com/parent-category/product-category.html/page/2) This is a code that i added to function.php on my site function wpse_178112_category_permastruct_html( $taxonomy, $object_type, $args ) { if ( $taxonomy === 'product_cat' ) add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%.html", $args['rewrite'] ); } add_action( 'registered_taxonomy', 'wpse_178112_category_permastruct_html', 10, 3 ); Please help, I'm just a Wordpress newbie . Thank …
My site with pictures is set up so that the posts do not have a title and have only tags. I would like to know how to use all tags in permalinks settings?
Can any one please explain how to add a post in WordPress without assigning it to any category. Actually I want to display some news or some quick information. So, it does not come to any category in my blog. In this type of time, I do not want to assign to any category. for example, http://www.someSiteURL.com/this-is-news-about-something-awesome/ http://www.someSiteURL.com/wordpress-themes/Anan-wordpress-theme-review/ The first url is what i want to have. But by default, it automatically add "uncategorized". My permalink structure is "/%category%/%postname%/" and …
I would like to add /blog in front of the url for a single post: e.g. website.com/blog/news-article -> single article website.com/blog -> blog archive (showing a list of all blogs etc.) Ive tried adding /blog/%postname% as the permalink structure, however it adds it in front of everything, including some custom post types: e.g. website.com/blog/shops/single-shop-page How do I go about adding it in front of posts but nothing else? Thanks in Advance! M
To make better looking category pages in my sites, I'm looking for a way to show the content of a regular page on the permalink /category/name. How can I achieve that ? Thanks
I've used a plugin called WP all-on-one migration to migrate my website. I've also saved the permalinks twice, as instructed after the importation. The default permalink setting works fine, but any other permalink setting results in a 404 error code (except for the home page). Plugin: https://wordpress.org/plugins/all-in-one-wp-migration/ Website: http://nieuw.ohmembercard.nl/ Already tried the following: 1. Saving the permalinks twice (as instructed after importing by the plugin) 2. Rename old .htaccess file, let the site automaticly create a new one
How can I redirect all posts permalinks from .html to / in WordPress? To be more clear, for example, a post URL like this: http://example.com/%category%/%postname%.html To be redirected to: http://example.com/news/%postname%/.html It's simple to redirect them one by one, but I need a rule to redirect all posts. My current .htaccess setup is: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
How can I change this code $posts = get_posts(array('post_type'=> 'lesson', 'post_status'=> 'publish', 'suppress_filters' => false, 'posts_per_page'=>-1)); //here you add the HTML of the dropdown you add something like echo '<p>Select the lesson: <select name="_dappcf_i_dropdown" class="widefat" style="width:170px" >'; foreach ($posts as $post) { echo '<option value="', $post->ID, '"'; if ($my_dropdown == $post->ID){echo ' selected="selected"';} echo '>'.$post->post_title.'</option>'; } echo '</select>'; } to echo the title of the selected post in page template with the URL of of SELECTED post(the title should be …
I have access to the admin panel, and everything works fine. I can click settings->reading and change anything I want to. But if I click settings->permalinks I get a 500 internal server error. Here's what I've tried: I deleted the .htaccess file - nothing changed. I edited the .htaccess (because I am migrating this site to a new domain) and now I have all the page links working on the front end AND all the admin links EXCEPT permalinks. In …
I am using an API which tracks metrics on parts of my site. The only useful bit it saves though is the URL (permalink). What is the most efficient way to query up all the posts that match those permalinks, given the fact that I don't have access to the ID's to use post__in with WP_Query.