Woocommerce - Remove image filename on product image gallery (lightbox) [closed] - css

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to remove the image filename that appears above the image in the lightbox functionality on the single-product page.
My images have a terrible naming structure and it is very distracting to the user to see "IMG_1234.JPG".
Is there a setting in WooCommerce that will allow me to toggle this on and off? Or will I need to change the file by adding/removing code?
Thanks in advance...

If you use any woocommerce compatible template then you'll find a directory named "woocommerce" in your template folder.
If you can't find it then it'll be the wp-contents/plugins/woocommerce/templates directory. In that case your theme doesn't overwrite the default layout. Then you need to find templates(or woocommerce)/single-product/product-image.php file. Around line 21 you should find something as following-
$image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
add // infront of that line (comment that out) as follows-.
// $image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
Now search for something rel="prettyPhoto' around in line 31. Remove title="%s" from that line where you find rel="prettyPhoto'.
Again find product-thumbnails.php in the same folder of the previous one. In around 40 you'll see something as follows like before-
$image_title = esc_attr( get_the_title( $attachment_id ) );
Comment this out adding two forward slashes(//) just like the previous one.
Now again in around line 42 search for something prettyPhoto[product-gallery] and when you find it look for title="%s" nearby and remove it like before.
This will remove the title form the lightbox picture viewer.
Instead of all these works you can simply use this following script inside your header.php file or anywhere you may find suitable-
<script>
jQuery(document).ready(function(){
jQuery('a[rel*="prettyPhoto"]').attr('title','').find('img').attr('alt','');
});
</script>

Related

Change the HTML tags of shop page in woocommerce [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm going to change the shop product title tag from H2 to H6. Please advise from which file these changes should be applied?
Summary:
sample.com/shop (this page)
h2-->h6
Update
As per your screenshot, you might want to do this using JavaScript/jQuery, since you're probably not using the default WooCommerce template. Hence, you can try the following snippet to achieve what you're looking for (I'm using jQuery here):
<script>
jQuery(document).ready(function(){
jQuery("h2.woocommerce-loop-product__title").each(function(
/* First we save the title */
$saved_text = jQuery(this).text();
/* Now we replace the tag */
jQuery(this).replaceWith("<h6 class='woocommerce-loop-product__title'>"+ $saved_text + "</h6>");
));
});
</script>
Note that I haven't been able to test the code. If you try this and it doesn't work or shows any issue, send me a screenshot and a small description of what steps have you taken to implement the code.
First, you need to create a child theme (if you don't have one already).
If you want to edit the shop page's title tag:
Then add a folder named woocommerce in the child theme.
Go to wp-content/plugins/woocommerce/templates and copy the archive-product.php file to your child theme's woocommerce folder.
Now, edit the archive-product.php file that is inside your child theme's woocommerce folder:
Find line 34 and change the tag to h6.
The current line looks like this:
<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
You'll change this line to this:
<h6 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h6>
In rare occasion, if this doesn't work, create a functions.php file in your child theme unless you already have it, and in it, add the following:
add_action('after_setup_theme', 's_my_custom_woocommerce_support');
function s_my_custom_woocommerce_support(){
add_theme_support( 'woocommerce' );
}
If you want to change the title tag of individual products:
In your child theme, create a file called functions.php unless you already have it and in it, add the following:
//First we remove the current title
remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 );
//then we add our title
add_action('woocommerce_shop_loop_item_title', 's_woocommerce_change_product_title_tags', 10 );
//here we define how our title looks
function s_woocommerce_change_product_title_tags() {
echo '<h6 class="woocommerce-loop-product_title">' . get_the_title() . '</h6>';
}
Make sure you're adding the code inside <?php and ?>. Add these before and after the code if you're creating a brand new functions.php file.
However, please note that you can simply style the title using css classes and skip all these fuss, unless you absolutely need to change the tag (potentially for SEO or other purposes).

How do I add extra fields in Dokan? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
Good Day.
I am developing a multivendor website for my client and I used Dokan. My client would like his vendors to add a (Sample Product Price) and (Bulk Product Price).
Is there any way to add those fields?
He also would like his vendors to add custom tags to their products.
Regards,
Go to dokan plugin directory. then go to the below path
1) templates/products/new-product-single.php
2) templates/products/new-product.php
You can override the new-product.php and new-product-single.php file in your child theme and then add your field. However, there are some other steps required to successfully save them.
These below hooks to save and update the field data.
do_action( 'dokan_new_product_added', $product_id, $post_data );
do_action( 'dokan_product_updated', $post_id );

How I can load a css file in all dashboard pages and my wp theme? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
How I can load a css file in all dashboard pages and my WP theme with wp_enqueue_style?
My CMS is WordPress.
put this into you functions.php, also make sure to create the .css file in the correct spot. here is the link to the codex
function load_custom_wp_admin_style() {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

Kallyas theme in Wordpress add slider php code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have installed a slider plugin called Revolution Slider for my Kallyas theme. I need to add the php line code so that I get my slider working. Can anyone help about where should I exactly place that line?
There is a three ways to insert into the theme and the slider appears in your pages:
For all the pages: <?php putRevSlider( "slider_alias" ) ?>
For show only on homepage: <?php putRevSlider("slider_alias","homepage") ?>
For show on certain pages use: <?php putRevSlider("slider_alias","2,10") ?>. The numbers here are de ID of the pages.
Here the full documentation.
We would have to have see your header.php file / or see how the theme is structured in order to see where the best place would be to insert the PHP snippet provided by revslider.
Are you aware that you can use shortcode inside of your pages / posts instead of using the PHP snippet?
If it is to appear on every page you can add
to the header, footer or content pages (depending on where on the page you want to put it (and changing shortcodeXYZ to whatever the shortcode is).

Adding static content to Wordpress posts page? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I know I have a static page for my home page in Wordpress. I also have a page called "Rate Entries" as my blog page. After showing this to my client, and then showing her the admin section of Wordpress, she began typing a paragraph into Pages >> All Pages >> "Rate Entries" >> Edit.
The big problem here, as you all know, is that if "Rate Entries" is my posts page, that page content does not show there, only the posts. Is there any way to add that page content to the top of the posts page? I had hoped to find a plugin to do this, but to no avail.
Assuming you've set a custom page for the posts in the Wordpress backend (Settings > Reading), you just need to add a few lines of code to your index.php file in your theme. Like so:
//grab the id of the page set in the backend
$posts_page_id = get_option('page_for_posts');
//grab the post object related to that id
$posts_page = get_post($posts_page_id);
//display the content if any
if( $posts_page->post_content ){
echo wpautop( $posts_page->post_content ); //uses wpautop to automatically add paragraphs
}
In your case, you can add the code to display the loop below this code.
Hope this helps!
Assuming you want a hardcoded paragraph at the top of entries page before the list of all entries, Why not create a template page, assign it to your rate entries page and hardcode your paragraph in the code so it's always on the top.
Read about page templates here
Update
Have you tried doing a sticky post? that should solve your problem
Here's what I've found that I had to insert into the index.php page in order to get what I need accomplished. Right before the loop that cycles through the posts as crowjonah had mentioned.
<?php $page = get_page_by_title( 'Rate Entries' ); ?>
<header class="entry-header">
<h1 class="etnry-title"><?=$page->post_title;?></h1>
<p><?=$page->post_content;?></p>
</header>
What this does is take the page title and content for the page, and place it right above where the posts spill out. This way, she can edit that text, and it will update on the posts page.
I solved this problem by using a text widget. By using a plugin called "Display widgets" I can make sure that this text only displays on the blog page.

Resources