Tommy Pradana
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [MobilePress] Shortcodes issue?Simply, just copy shortcode functions in your main theme, to theme in mobilepress plugin, the theme is located in plugins/mobilepress/themes/yourtheme
copy your functions shortcode like “add_shortcode() { }” to your mobile press theme
and, shortcodes should work after that
Forum: Fixing WordPress
In reply to: help with custom-taxonomy-related-posts-querytry this, use tag taxonomy called album_tag on my theme, you can changet to your taxonomy to be show….
<?php $orig_post = $post; global $post; if ( 'YOUR_POSTTYPE' == get_post_type() ) { $tags = wp_get_post_terms($post->ID, 'YOUR_TAXONOMY'); if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( 'tax_query' => array( array( 'taxonomy' => 'YOUR_TAXONOMY', 'terms' => $tag_ids, 'operator' => 'IN' ) ), 'post__not_in' => array( $post->ID ), 'posts_per_page' => 3, 'ignore_sticky_posts' => 1 ); $my_query = new wp_query( $args ); if( $my_query->have_posts() ) { ?> <div class="related"> <h2><?php esc_html_e('Related Products','eStore'); ?></h2> <ul class="related-items clearfix"> <?php $i=1; while( $my_query->have_posts() ) { $my_query->the_post(); ?> <li<?php if($i%2==0) echo(' class="second"'); ?>> <a href="<?php the_permalink(); ?>" class="clearfix"> <span><?php the_title(); ?></span> </a> </li> <?php $i++; ?> <?php } ?> </ul> </div> <?php } } } $post = $orig_post; wp_reset_query(); ?>Forum: Hacks
In reply to: how to sort post by selected custom taxonomyOkay, i have solved the problem of my code,
here it is
<?php $template_settings = array(); $template_settings = maybe_unserialize( get_post_meta($post->ID,'albummanager_settings',true) ); $albummanager_cats = isset( $template_settings['albummanager_cats'] ) ? (array) $template_settings['albummanager_cats'] : array(); $albummanager_showposts = isset( $template_settings['albummanager_showposts'] ) ? (int) $template_settings['albummanager_cats'] : 10; ?> <?php $recent_categories = is_array($albummanager_cats) ? $albummanager_cats : array(); $i=1; ?> <?php foreach ( $recent_categories as $category_id ) { $term = get_term( $category_id, 'album_category' ); ?> <?php if ( $i == 1 || ( ($i-1) % 4 == 0 ) ) { $div_open = true; ?> <div class="clearfloat clearfix"> <?php } ?> <div id="cat-<?php echo $category_id; ?>" class="box<?php if ( $i%4 == 0 ) echo ' last'; ?>"> <div class="box-title"> <h2><a href="<?php echo get_term_link( $term, 'album_category' ); ?>"><?php echo $term->name; ?></a></h2> </div> <?php $recent_radis_args=(array( 'post_type' => 'album', 'tax_query' => array( array( 'taxonomy' => 'album_category', 'terms' => $category_id, ) ) ) ); $recent_radis_query = new WP_Query($recent_radis_args); while ( $recent_radis_query->have_posts() ) : $recent_radis_query->the_post(); ?> <article class="box-content clearfix"> <h2 class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title(); ?></a></h2> </article><!--end .box-content --> <?php endwhile; wp_reset_postdata(); ?> </div> <!-- .home-block --> <?php if ( $i % 4 == 0 ) { $div_open = false; ?> </div> <!-- .clearfloat --> <?php } ?> <?php $i++; ?> <?php } ?> <?php if ( isset( $div_open ) && $div_open ) { ?> </div> <!-- .clearfloat --> <?php } ?>
Viewing 3 replies - 1 through 3 (of 3 total)