Woocommerce Recently Viewed Products Wordpress - php

I want to include in my website the " Recently Viewed Produdcts" widget. I found out that i can do that with a shortcode as mentioned here: http://www.wpexplorer.com/woocommerce-recently-viewed-products-shortcode/
After implementing this code and creation of plugin the products appear in homepage very weird, very big and without any styling. Then i found out that there is already a widget in the widget section provided by woocomerce already.
I am very satisfied with the styling of it but i have some questions that i want to fix:
How do i add the widget to appear on all page just before the footer area?
How do i make that widget horizontal instead of vertical?
Thanks to whoever help me out !!!

You're going to have to insert the following into your footer.php file before the other div boxes start:
<div>
<?php
echo do_shortcode("[woocommerce_recently_viewed_products per_page='5']");
?>
</div>
Then we'll have to see what the styling looks like once that is in place.

First, install the plugin "Recently Viewed Products Shortcode"
then:
<div><?php echo do_shortcode("[woocommerce_recently_viewed_products per_page='5']"); ?></div>
'5' instead "5"

Related

how to locate a custome php function

I am a c# developer but I have a website for my family business that has been developed using PHP, woocommerce and wordpress about 5 years ago by a developer that I can't connect with him anymore. the problem is as following:- I did an update to the woocomerce plugin so I can use quick books when I did that the update the category page (which I know for a fact that he did custom build it ) lost the text under the images, I did inspect the elements in the browser, the text is their but there is a lot of space that why it is hidden , i don't know why this happened after the update but anyways, when I checked the page tab in the wordpress I did find this line of code
<pre class="brush: php; gutter: false">[product_categories per_page="12" columns="3" orderby="date" order="asc"]</pre>
As I said I don't know much of PHP but I expect "product_categories" is a function located in some file
also when I checked the inspect tab in the browser I found that the text and the image of the category is inheriting form class "product-category" "product" "first"
this is the line of the html of one of the categories just to have a better idea
<li class="product-category product first">
<a href="https://www.WebsiteName.ca/product-category/backdrops/">
<img src="https://www.WebsiteName.ca/wp-content/uploads/2017/02/backdrops- 300x300.jpg" alt="Backdrops" srcset="https://www.mosaiceventrentals.ca/wp- content/uploads/2017/02/backdrops-300x300.jpg 300w, https://www.WebsiteName.ca /wp-content/uploads/2017/02/backdrops-150x150.jpg 150w, https://www.WebsiteName.ca/wp-content/uploads/2017/02/backdrops-180x180.jpg 180w" sizes="(max-width: 300px) 100vw, 300px" width="300" height="300">
<h2 class="woocommerce-loop-category__title">
Backdrops
<mark class="count">(10)</mark>
</h2>
</a></li>
-I did try to download all the files from the server and search in each file for this function but no luck
I checked the bootstrap file for for the function "product-category" "product" "first" but I didn't find these classes
Basically I want to remove all extra space so the title can appear under the image but I want to know how to locate the file it is coded in
so after searching for a while I started to think out side of the box and discovered that the their was a line spacing error in the paragraph before the category list that was affecting the appearance of category titles. one other thing I found is that the new update for the woocommerce have a function to create a category list that link to the list of products under each category and the styling is much better than the custom made one.
just a reference to do that is as following:-
1- Dashboard --> Products --> Categories and you can add, edit and delete categories
2- in order to view the shop page as categories NOT the products you go to Dashboard --> Appearance --> customize --> woocommerce --> Product Catalog --> then select Show categories
3- then in order to add the welcome paragraph just go to Dashboard-->Pages--> All Pages select the shop page and click edit and just write the welcome paragraph.
thanks everyone for your help and suppourt

List Category posts Wordpress plugin not working

I am new to WordPress and trying to use the List Category WordPress plugin to show posts by category on the home page. I have installed and activated the plugin and as given in their documentation (https://github.com/picandocodigo/List-Category-Posts/blob/master/readme.txt), added the following code to the index.php file to get posts by category name:
[catlist name="bike-rides"]
(it is surrounded by ` on both sides, stackoverflow is formatting it)
On adding this code, this text shows up on the website instead of showing posts by this category.
Can anyone please help? I am probably doing something very stupid so please bear with me.
Hi can you please try this
<?php echo do_shortcode( '[catlist name="bike-rides"]' ); ?>
we should use do_shortcode function to insert shortcodes inside php files in wordpress, pls try it

Adding plugin to sidebar file in WordPress

So im in the middle of creating a site with WordPress but now Im stuck at the sidebars.
In sidebar.php-file I have added some text and CSS rules as a test and they are shown at the site as a sidebar. However, I want to show the forum's latest posts in this sidebar instead.
Im using a plugin called "tt post viewer". I tested it out on a page at the site and it shows me the latest post.
But im not sure what code I should add to the sidebar.php-file so that the plugin print the latest post at the sidebar.
And if it's possible?
https://wordpress.org/plugins/tt-post-viewer/
Would be grateful if anyone could help me out.
Thanks!
yours sincerely, Winterwind
You don't need to add code to the sidebar. Make sure your sidebar is wdiget-ready and just drag and drop the widget in the Wordpress Backend into your sidebar.

Programming custom PHP with Wordpress

I have a question regarding PHP and Wordpress.
I recently started using Wordpress for a simple website but there is still one thing that I just don't understand. Lets say I made a cool website in php that also cointains my header, my footer and my menu. How do I implement the Wordpress CMS so that someone else can add an item in the menubar that I made, instead of adding an item in a theme made by someone else? I have a hard time finding such tutorials because most of them are for people with no programming interests and because of that they don't explain such things.
If your only concern is how to connect your menu to the wordpress admin, you can check this link: wp_nav_menu()
that wordpress function will then generate a list of the menu items you add on the admin.
For example use this on your theme to display a menu from the admin with the name "Main Menu":
<div class="my-menu">
<?php wp_nav_menu(array('menu' => 'Main Menu' )); ?>
</div>

Adding inline wordpress comment functionality to a non-wordpress page

I have created a wordpress.org blog on my website but I do not use the actual blog page to display the blog posts. Initially I tried to style the wordpress blog to match my site, but since wordpress' theme is too constricted I decided to use "the loop" to gather the_author_posts_link, the_title, the_content, etc and display them on my main page. (reference: http://www.corvidworks.com/articles/wordpress-content-on-other-pages). The problem I am running into is the comment section. No matter what, I cannot seem to find a way to add comments to my front page using php. I know I can get my post content to display by calling the_content(), but I cannot seem to find a similar function for comments. I'm open to any solution that will allow my pseudo-blog to display comments under each post.
Thank you!
Should be <?php comments_template(); ?>. Look in your theme files for that template tag. But it working depends on if you've correctly included the blog header on your non-WP pages.

Categories