Jump to content

mnybud

Members
  • Posts

    80
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

mnybud's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. Good advice but I am not very good at PHP (obviously) so did what I could figure out and modified it in a way that works for me. It has been this way for over a year with no problems There is not a good way to filter out products in woocommerce for my use as I am actually filtering out the $0 products and not actual out of stock items. Thanks again for the advice but for now I am just looking for a way to modify the code above.
  2. Hi. I need some help making some changes to some code. I have tried several things and still can't seem to get it right so hoping someone here can help me out. This is the original code I wrote that I am trying to change.... <?php do_action( 'woocommerce_before_shop_loop_item' ); ?> <a href="<?php the_permalink(); ?>"> <?php /** * woocommerce_before_shop_loop_item_title hook * * @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action( 'woocommerce_before_shop_loop_item_title' ); ?> <?php echo $product->is_in_stock() ? '' : '<img src="notavailable.png" class="attachment-shop_catalog wp-post-image">'; ?> <h3><?php the_title(); ?></h3></a> <?php do_action( 'woocommerce_after_shop_loop_item' ); ?> What I am trying to accomplish is to make it so my shop only shows the product if it is in stock. Currently the code above adds a notavailable.png to out of stock items but still displays them. I tried something like this but I am not able to make it work. <?php echo $product->is_in_stock() ? ' <?php do_action( 'woocommerce_before_shop_loop_item' ); ?> <a href="<?php the_permalink(); ?>"> <?php /** * woocommerce_before_shop_loop_item_title hook * * @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action( 'woocommerce_before_shop_loop_item_title' ); ?> <h3><?php the_title(); ?></h3></a>' : ''; ?> <?php do_action( 'woocommerce_after_shop_loop_item' ); ?> If anyone can help me get this right I would really appreciate it.
  3. I have limited PHP knowledge and have been fighting with something that is probably not to hard for you PHP freaks so hoping someone can provide me with a solution. Here is what I am trying to accomplish... I have this code that works. <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $product; ?> <?php echo $product->is_in_stock() ? 'in stock' : 'out of stock'; ?> What I am trying to get working is this below but so far I am having no luck figuring it out with my lack of PHP knowledge. More or less I am trying to echo my form which has some other PHP code that breaks it. Can anyone help? Thanks so much in advance! <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $product; ?> <?php echo $product->is_in_stock() ? ' <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?> <form name="order" action="<?php echo esc_url( $product_url ); ?>" method="post"> <input type="image" src="image.png" onClick="ga('send', 'event', { eventCategory: 'Button', eventAction: 'click', eventLabel: 'Button'});"/> </form> <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?> ' : 'out of stock'; ?>
  4. anyone else help. the suggested code above actually doesnt even work on a single term
  5. well obviously I suck at PHP, which would be why
  6. thanks but that still is not working. It works if the page title is one word but not if it is more than one. and in this case the urls do include a space....example. max results http://www.amazon.com/rss/tag/ipod accessories/new/ref=tag_tdp_rss_new_man?tag=biblesforthew-20 limited results http://www.amazon.com/rss/tag/ipodaccessories/new/ref=tag_tdp_rss_new_man?tag=biblesforthew-20
  7. Trying to figure this out... <?php echo get_the_title(); ?> works to display my wordpress post title on the page. how can I echo that inside this code? <?php if (function_exists('simple_feed_list')) : ?> <?php simple_feed_list('I WANT TO ECHO TITLE HERE'); ?> <?php endif; ?>
  8. I have also tried this with no luck... anyone have any ideas? <?php if (function_exists('simple_feed_list')) : ?> <?php $title = get_the_title(); simple_feed_list('http://www.amazon.com/rss/tag/'. str_replace("", "", $title) .'/new/ref=tag_tdp_rss_new_man?tag=search-20','limit=5&desc=yes&nofollow=yes&more=no'); ?> <?php endif; ?>
  9. I am trying to learn PHP and am a novice so please excuse the stupid question but I have researched and attempted to find a solution for this and cant. Hoping someone can help me. I have the following code I am using within a Wordpress template... <?php if (function_exists('simple_feed_list')) : ?> <?php $title = get_the_title(); str_replace("+", " ", $title); simple_feed_list('http://www.amazon.com/rss/tag/'. str_replace(" ", "+", $title) .'/new/ref=tag_tdp_rss_new_man?tag=search-20','limit=5&desc=yes&nofollow=yes&more=no'); ?> <?php endif; ?> I am trying to make it produce a RSS feed url from amazon that looks like this: http://www.amazon.com/rss/tag/ipod ibuds/new/ref=tag_tdp_rss_new_man?tag=search-20 note the space between ipod and buds, that is what I am trying to accomplish. Right now the space is being changed I think to a + sign which breaks the feed if the search term is more than one word. Can anyone help me fix this? I have tried removing the string replace part, etc with no luck
  10. is it not possible? Everything I try breaks things
  11. I actually want to replace it in the wp_title portion, how would I modify it to do that since it is using print? <?php elseif ( is_single() ) { wp_title(''); print ' | '; str_replace("'", "", bloginfo('name')); } ?> (thanks a lot for the help)
  12. yes I got that but how would I insert it properly in the code above is my problem....can you give a working example with the code above please? Thanks for the help!
  13. First and foremost I am PHP newbie so excuse the dumb question but I have been struggling with this one for hours and can not find the solution. Can someone show me how I would rewite the following wordpress code for meta tags so that it automatically strips out the character ' from the "single" page titles? Example I want this title: "My Cat's Black" to be "My Cats Black" This is the line I am trying to edit..... elseif ( is_single() ) { wp_title(''); print ' | '; bloginfo('name'); } here is the full piece of code... <title><?php if ( is_home() ) { bloginfo('name'); print ' | '; bloginfo('description'); } elseif ( is_search() ) { bloginfo('name'); print ' | '; _e('Search Results', 'woothemes'); } elseif ( is_author() ) { bloginfo('name'); print ' | '; _e('Author Archives', 'woothemes'); } elseif ( is_single() ) { wp_title(''); print ' | '; bloginfo('name'); } elseif ( is_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); } elseif ( is_category() ) { single_cat_title(); print ' | '; bloginfo('name'); } elseif ( is_month() ) { _e('Archive', 'woothemes'); print ' | '; the_time('F'); bloginfo('name'); } elseif (function_exists('is_tag')) { if ( is_tag() ) { bloginfo('name'); print ' | '; _e('Tag Archive', 'woothemes'); print ' | '; single_tag_title("", true); } } ?></title> Any help would be greatly appreciated!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.