tresinvolved
Forum Replies Created
-
Forum: Plugins
In reply to: [WC Fields Factory] After woocommerce 2.4.6 fields factory v1.2.1 disappearAlso, this WooCommerce support thread might help:
2.4 Common Issue: Variations missing on product pages – have you customized any of the template pages?
Forum: Plugins
In reply to: [WC Fields Factory] After woocommerce 2.4.6 fields factory v1.2.1 disappearI’m not experiencing this using 2.4.6 and Fields Factory 1.2.1 – have you tried changing your WordPress theme to see if that makes a difference?
Forum: Plugins
In reply to: [WC Fields Factory] "Order Again" not transferring custom fieldsHere’s some code I have that is not working – hopefully someone can let me know what I need to adjust to get it working:
add_filter( 'woocommerce_order_again_cart_item_data', 'tres_add_shirt_text_to_order_again', 10, 3 ); function tres_add_shirt_text_to_order_again($cart_item_data, $item, $order) { global $woocommerce; // I saw this next line in some similar code on the web, but I'm not sure if it is necessary? remove_filter( 'woocommerce_add_to_cart_validation', array( $woocommerce, 'validate_add_cart_item' ), 10, 3 ); $key = 'Shirt Text'; if ( ! array_key_exists( 'item_meta', $cart_item_data ) || ! is_array( $cart_item_data['item_meta'] ) ) { $cart_item_data['item_meta'] = array(); } $cart_item_data['shirt_text'] = $product['item_meta'][$key][0]; $cart_item_data['item_meta']['shirt_text'] = $product['item_meta'][$key][0]; return $cart_item_data; }
Forum: Fixing WordPress
In reply to: Inserting a Shortcode into conditional with Custom FieldYou may also want to do a
if ( function_exists( 'insert_audio_player') )
check somewhere there, just in case you remove the audio player plugin at some point.
Forum: Fixing WordPress
In reply to: Inserting a Shortcode into conditional with Custom FieldActually, from looking at the Audio Player FAQ, it looks like you want this instead:
<?php $values = get_field('mp3_link'); if($values) { echo '' . insert_audio_player(' [audio:$values] ') . ''; } ?>
Forum: Fixing WordPress
In reply to: Inserting a Shortcode into conditional with Custom FieldHow about if you do:
echo '' . do_shortcode(' [audio:' . $values . '] ') . '';
Where is the code coming from? A template file?
Forum: Fixing WordPress
In reply to: child nav on parent page (which is blog)Okay, so can you just manually set the $post->ID in the wp_list_pages function (in the section that echoed “C”) to be that of the About Page? Does that work?
I’m guessing Events is returning a blog post for $post->ID and not the Events Page ID. Hard to know for sure without knowing what your Events Page template is.
Forum: Fixing WordPress
In reply to: child nav on parent page (which is blog)So it is seeing the “Events” Page as a blog?
It might help to know which conditional is getting hit in your initial if/else. Just add some test echo statements:
if ($post->post_parent) { //get the parrent and see if it'a a top page (has no parent) $parent = get_page($post->post_parent); if ($parent->post_parent) { echo "A"; /* Testing */ //if it's not a top page, then his parent should be $children = wp_list_pages('title_li=&child_of=' . $parent->post_parent . '&echo=0'); } else { echo "B"; /* Testing */ $children = wp_list_pages('title_li=&child_of=' . $post->post_parent . '&echo=0'); } } else { echo "C"; /* Testing */ $children = wp_list_pages('title_li=&child_of=' . $post->ID . '&echo=0'); }
Might also help to echo the $post->ID to see if you’re viewing the ID of the Events page, or something else.
Also, I’m not sure about this part of your code (in two places):
<li><a>">
What is the quotation mark for?
Forum: Fixing WordPress
In reply to: Else if and ShortcodesSo the shortcode works elsewhere in your theme? And you’re returning it, not echoing the results in the shortcode function?
Is that code above going in a template?
Forum: Fixing WordPress
In reply to: Else if and Shortcodes<?php if (has_post_thumbnail( $post->ID ) ): $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <img src="<?php echo $image[0]; ?>"> <?php else: $content = 'Maybe some text, [someshortcode] maybe more text'; echo do_shortcode( $content ); endif; ?>
Untested, but hopefully this works:
<?php $args = array('orderby' => 'count', 'order' => 'ASC', 'taxonomy' => 'works'); $categories=get_categories($args); foreach($categories as $category) { if ( 0 == $category->category_parent ) { // if parent category echo '<h1><a href="' . get_category_link( $category) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></h1>'; echo '<p>'. $category->description . '</p>'; } // end if parent category } // end foreach ?>