woocommerce pagination not working - wordpress

On my locally hosted site is the woocommerce pagination not working properly.
When I use http://localhost/sample-post/ the second page is a wrong one. I'm landing on an attachment page instead of the second product page.
When using http://localhost/?p=123 it works ok.
Anyone an idea?
Is it because I'm working locally and will it not be on a remote server? I've read something about that. Need confirmation.
EDIT
Went worse.....
I have to translate the site in different languages using WPML. When using the default permalinks WPML complains. When using another structure (see above) and in WPML the setting for a different folder for each language I got pages with no result (except for a message from woocommerce that no products were found.
EDIT 2, February 18th, 2015
I start to wonder if it is even possible to set the WooCommerce shop page as the Front page. The support team of WooCommerce is puzzled as well and are wondering too if it is possible. I hope someone has experience with it or an example of a site on which it works.
Please, can anyone help me out here... I'm struggling now for a long time and I'm not able to solve this myself.

your permalinks settings need adjusting. in wp-admin go to settings>permalinks>common settings, and set "per post." check your product permalink base as well.

Please use this function for correct woocommerce pagination. please use this function inside the function.php
add_filter( 'woocommerce_pagination_args', 'rocket_woo_pagination' );
function rocket_woo_pagination( $args ) {
$args['prev_text'] = '<i class="fa fa-angle-left"></i>';
$args['next_text'] = '<i class="fa fa-angle-right"></i>';
return $args;
}

Related

content area not found in my page with elementor

I just started with Wordpress and I published a website a few weeks ago. Today I wanted to edit the homepage, but I get the following error:
Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page.
I haven't edited my homepage and it worked perfectly a couple of weeks ago. Is there someone that can help me fix this issue?
If you are using any shortcode on your page and you are fetching post on that page and looping through the post in a while loop. Please add this after the loop ends. No sure why but this always cause issue for me.
wp_reset_postdata();
Code will look like this:
$posts= new WP_Query($args);
while ($posts->have_posts() ) : $posts->the_post();
.....
.....
.....
endwhile;
wp_reset_postdata();
It doesn't matter it's a shortcode or what if we are doing something like above make sure to add wp_reset_postdata();
This is one of the issues that I usually face. There can be other reasons too.
Probably you've edited the page template from Templates -> Theme Builder -> Single. Anyway, even if you don't, you can fix it that way: Go to Templates -> Theme Builder -> Single -> Add New, then select page and create a template for all single pages (make sure that you drag the page content widget in the template). This should overwrite your theme single page template (which misses the content function).
Just make sure your 'Home Page' and 'Posts Page' are different, otherwise you get your page mixed up and this error occurs.. Worked for me!
You can verify this setting in Appearance>Customize>Homepage Settings :)
The Answer to this error is to check the structure of your permalinks. Try to save your permalinks one more time. Also, try to change the permalink structure to “Plain”. Some servers do not allow to write to the .htaccess file and as a matter of fact, you cannot always modify your permalink structure and edit with Elementor.
I found myself in the same place yesterday and freaked for a moment and did some research to find out why I was receiving the error and came across this page. Believe for me it occurred due to the situation Ed Jones posted about above, I had inadvertently edited the post template. But a fast and easy fix was to go back to an earlier revision of the page in my history. That solved my problem quickly.
Add the_content() at the end of your templates

Wordpress Job Manager Pagination Issue

I am using the Wordpress Jobs Manager plugin. It all works great except the pagination feature. When enabled, the pagination buttons just redirect the user to the homepage instead of to the paginated page of results. As far as i can tell this is a problem with permalinks but i wondered if anyone had a workaround as i cannot use the standard permalinks on my site.
Does anyone know of any possible fixes? Its a custom built theme.
Thanks for you help guys
I know its a long time since you posted, but i had this issue today and came across your post.
I did some investigating and found it to be a problem with the way wordpress was dealing with the rewrites for canonical redirects.
I did a search on the internet and found the following post on wordpress.stackexchange.com by Celine Garel which deals with this situation for custom post types, i just changed it to work with a page.
https://wordpress.stackexchange.com/questions/134339/pagination-on-custom-post-type-not-working-if-permalinks-set-to-rewrite-url
Add this to your themes function file,
add_filter( 'redirect_canonical','custom_disable_redirect_canonical' );
function custom_disable_redirect_canonical( $redirect_url ){
if ( is_page('Your_job_list_page') ) $redirect_url = false;
return $redirect_url;
}
This fixed it for me. Hope it helps you or anybody else.

Hide Wordpress dashboard?

I'm new to wordpress and a bit confused with something. I'm trying to build a classified marketplace type of website for myself. I am NOT building this for a "client". I will probably be using a hack of several different plugins as my coding skills are not up to par. Eventually I will hopefully have lots of users who will be composed of buyers & sellers.
My question pertains to the WP dashboard. When buyers/sellers sign up for my site, will they be able to see the backend WP dashboard? I would prefer that they NOT be able to access a backend dashboard at all let alone a WP branded one. Is this possible? If so any clue as to how this might be accomplished?
thank you Brian
Normal users do not actually see the 'backend' WP dashboard. What they are seeing is a 'profile' type page meant for the original functionality of wordpres; being a blog.
If you do not want users to go to this page when they log-in, you can use a couple of hooks. Here is some code that redirects to the front page after logging-in and logging-out. This goes in your functions.php file.
add_action('login_form', 'ang_redirect_to_front_page');
add_action('wp_logout', 'go_home');
function ang_redirect_to_front_page() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
function go_home(){
wp_redirect( home_url() );
exit();
}
And, if your theme is still displaying the menu at the top of the screen that allows the users to go to this 'profile' area, you can go into your footer.php file and remove this:
<?php wp_footer();?>
However, if you do this, then you will not see it as the admin either.
WordPress is might not be the thing to use for that kind of website, even with a bunch of plugins. Read up on other content management systems just incase.
This link might answer your question:
http://buddypress.org/support/topic/how-to-prevent-non-admins-from-accessing-wp-admin-dashboard/
You can also add this to your theme's function.php file:
// DISABLE ADMIN BAR FOR ALL USERS
show_admin_bar( false );
If you are not too used to wordpress, use WOOCOMMERCE plugin. Its completely free and well documented

How to properly modify 2 lines of another plugins

I am coding some permalinks rewrite for WooCommerce awesome plugin.
Everything is well packed in a plugin and work well... except for one thing.
WooCommerce use get_term_link() to display HTML link in default template. A lot of custom templates use it too. If I want to display the good link on my website, I must change one line of code in woocommerce plugin. This is dirty, since basic user would not do it. Since I want to list it on Wordpress plugin repertory, I would like some help here...
What I need to do :
Open woocommerce.php and replace line 767 :
OLD
$product_category_slug = empty( $permalinks['category_base'] ) ? _x( 'product-category', 'slug', 'woocommerce' ) : $permalinks['category_base'];
NEW
$product_category_slug = '';
Very easy to do by editing the file, but it is dirty. It is non user friendly, and it depends a lot of woocommerce next version... So my question here: how can I do it from my own plugin, without asking people to open their woocommerce plugin with Notepad++... Is there any way ?
I hope you understand my need and could provide me with an answer :)
I already did same thing in Past.
Please Don't Modify WooCommerce Core files, Because it will be gone in your next upgrade.
Use this Custom Permlink Plugin, You will get Better Options there,

Change management in WordPress

I have a beginner question. What is the best way to address the change management issues in WordPress? I have an all-pages WordPress installation. Suppose name of some event or an entity changes from A to B, then I have to go to all the pages to make that change. Is there any better way of doing it? Like externalization or something.
Or the way similar to how WordPress handle blog name using bloginfo() function. You change blog name at one place and it is reflected everywhere.
Thanks,
Paras
If a URL on your site changes, it is always wise to leave a redirect to the new page. This will help your visitors and search engines. If you create redirects, it doesn't matter too much if you still have a link to the old address in one of your posts. There will probably be a plugin for this, but I don't know which one.
If you really want to keep all links pointing to the latest version, you could replace them with shortcodes that are evaluated to the real URL. <a href="[linkto postid=123]"> would then result in <a href="/2010/08/05/some-post">. I think this is doable, but I don't know whether a plugin already exists for this.
You can also use this technique to replace short snippets, like your company name. The Shortcode API is really easy:
// [company_name]
function replace_company_name($atts) {
return "My Awesome Company";
}
add_shortcode('company_name', 'replace_company_name');
// More generic
// [replace r='company_name']
// [replace r='company_motto']
function do_replacement($atts) {
$replacements = array(
'company_name' => 'My Awesome Company',
'company_motto' => 'A Company so Awesome even you would want to work here!',
);
return $replacements[$atts['r']];
}
add_shortcode('replace', 'do_replacement');
You can hardcode the strings in your plugin code, or you could create a Wordpress options page where users can add and edit new shortcodes.

Resources