Jump to content

drewhew

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by drewhew

  1. I understand, thanks for your consideration.
  2. I didn't ask them about this specifically. I've inquired about a few other features and they've always been met with "hire a freelancer", so I thought I'd go it alone.
  3. Hi QuickOldCar, The site uses a directory theme. Yes, the overall goal is essentially to sort the results and give top-ranking status to those earning a high number of good ratings. The url is http://merit.jamaica2go.com/dev (I'll message you temporary login as it's a members only directory)
  4. Working on a website directory that includes ratings for listed companies. Trying to obtain information from database that would put some companies in a higher category than others. Or at least, I believe that is the approach I should be taking. There are a few tricky issues. 1. Ratings are their own custom posts but are attached to company pages (parents) 2. Rating values I need to obtain are meta keys (1. total number of ratings & 2. rating average of EACH) 3. Ratings are based on four criteria which are summed and averaged for each rating submitted. As a result, values are rarely single digits such as 4 or 5 but include decimals rounded to 1 place (e.g. 4.8 or 3.5) Additional info: Ratings are based on 5-star system (out of 5) Higher category would be business that achieved at least 10 ratings of 4 or more Any help appreciated.
  5. Here's the snippet from the main page: if ( ! function_exists( 'uxbarn_custom_port_load_portfolio_shortcode' ) ) { function uxbarn_custom_port_load_portfolio_shortcode( $atts ) { $default_atts = array( 'categories' => '', 'max_item' => '', 'type' => 'col4', // col3, col4, flexslider_fade, flexslider_slide 'show_filter' => 'true', // true, false 'show_title' => 'true', // true, false 'img_size' => '', 'interval' => '', // 0, 5, .. 'show_bullets' => 'true', // true, false 'orderby' => '', 'order' => '', 'el_class' => '', ); extract( shortcode_atts( $default_atts, $atts ) ); if ( trim( $categories ) == '' ) { return '<div class="error box">' . __( 'Cannot generate Portfolio element. Categories must be defined.', 'uxb_port' ) . '</div>'; } $category_id_list = explode( ',', $categories ); // If WPML is active, get translated category's ID if ( function_exists( 'icl_object_id' ) ) { $wpml_cat_list = array(); foreach ( $category_id_list as $cat_id ) { $wpml_cat_list[] = icl_object_id( $cat_id, 'uxbarn_portfolio_tax', false, ICL_LANGUAGE_CODE ); } $category_id_list = $wpml_cat_list; } if ( ! is_numeric( $max_item ) ) { $max_item = ''; } // Prepare WP_Query args if ( $max_item == '' ) { $args = array( 'post_type' => 'uxbarn_portfolio', 'nopaging' => true, 'tax_query' => array( array( 'taxonomy' => 'uxbarn_portfolio_tax', 'field' => 'id', 'terms' => $category_id_list, ), ), 'orderby' => $orderby, 'order' => $order, ); } else { $args = array( 'post_type' => 'uxbarn_portfolio', 'posts_per_page' => $max_item, 'tax_query' => array( array( 'taxonomy' => 'uxbarn_portfolio_tax', 'field' => 'id', 'terms' => $category_id_list, ), ), 'orderby' => $orderby, 'order' => $order, ); } $portfolio = new WP_Query( $args ); if ( ! $portfolio->have_posts() ) { return '<div class="error box">' . __( 'There are no portfolio items available in the selected categories.', 'uxb_port' ) . '</div>'; } if ( $type == 'col3' || $type == 'col4' ) { $output = '<div class="uxb-port-root-element-wrapper ' . $type . ' ' . $el_class . '"> <span class="uxb-port-loading-text"><span>' . __( 'Loading', 'uxb_port' ) . '</span></span> <div class="uxb-port-loaded-element-wrapper">'; if ( $show_filter == 'true' ) { $filter_string = '<ul class="uxb-port-element-filters"> <li><a href="#" class="active" data-filter="*">' . __( 'All', 'uxb_port' ) . '</a></li>'; // Generate filter items $terms_args = array( 'include' => $category_id_list, 'orderby' => 'menu_order', ); $terms = get_terms( 'uxbarn_portfolio_tax', $terms_args ); if ( $terms && ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $filter_string .= '<li><a href="#" data-filter=".term_' . $term->term_id . '">' . $term->name . '</a></li>'; } } $filter_string .= '</ul>'; // close filter list $output .= $filter_string; } $output .= '<div class="uxb-port-element-wrapper">'; // Generate grid columns if ( $portfolio->have_posts() ) { while ( $portfolio->have_posts() ) { $portfolio->the_post(); // Prepare category string for each item's class $term_list = ''; $terms = get_the_terms( get_the_ID(), 'uxbarn_portfolio_tax' ); if ( $terms && ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $term_list .= 'term_' . $term->term_id . ' '; } } $thumbnail = ''; if ( has_post_thumbnail( get_the_ID() ) ) { $thumbnail = get_the_post_thumbnail( get_the_ID(), 'uxb-port-element-thumbnails' ); } else { $thumbnail = '<img src="' . UXB_PORT_URL . 'images/placeholders/port-grid.gif" alt="' . __( 'No Thumbnail', 'uxb_port' ) . '" />'; } $show_title_code = '<h3 class="portfolio-item-title">' . get_the_title() . '</h3>'; if ( $show_title == 'false' ) { $show_title_code = ''; } $output .= '<div class="uxb-port-element-item black-white ' . $term_list . '"> <a href="' . get_permalink() . '"></a> <div class="uxb-port-element-item-hover"> <div class="uxb-port-element-item-hover-info">' . $show_title_code . '</div> </div> ' . $thumbnail . ' </div>'; } } else { } $output .= '</div>'; // close class="portfolio-wrapper" $output .= '</div>'; // close class="portfolio-loaded-wrapper" $output .= '</div>'; // close class="portfolio-root-wrapper }
  6. Ronny, Can you provide a link to your website and give me a little explanation as to why you want the slider in the header?
  7. So, here goes... On my website, http://jamaica2go.com, I have destinations laid out in thumbnails on the main destination page. The page is using three columns. The page works fine as it is, however, I know that as I add more locations scrolling will become an issue. The author did a great job on this theme and he also gave an option to select maximum number of items to be shown but no paging occurs once you hit that max (weird, right?). I have tried, I really have. Reading up on the WP codex, hunting down scripts and tutorials, all with a view to adding this simple feature. I know if someone figures this out it's going to be easy as cheese but the drawback for me is that I'm not a PHP programmer, just pretty decent at editing and changing the code. Anyway, I'm posting the entire page code below (realised at end that I can attach, so did that instead). The important stuff happens in the "uxbarn_custom_port_load_portfolio_shortcode" function and onward. I noticed that although he starts a while loop to write the thumbnails to the page, he doesn't seem to end it. He also has a pagination template for the blog page which I'll add below but I couldn't make heads or tails of it. Hope someone can assist. PORTFOLIO PAGE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ The template below is used for blog and search and is called with: <?php get_template_part( 'template-pagination' ); ?> PAGINATION TEMPLATE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ <?php $big = 999999999; global $wp_query; $total_pages = $wp_query->max_num_pages; if( is_search() ) { // Only for search page, there are 10 posts per page // And always round up the result $total_pages = ceil( $wp_query->found_posts / 10 ); } if ( $total_pages > 1 ) { echo '<div class="row no-margin-bottom"> <div id="blog-pagination" class="uxb-col large-12 columns pagination-centered"> '; $current_page = max( 1, get_query_var( 'paged' ) ); echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '&page=%#%', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '<i class="icon ion-ios7-arrow-left"></i>', 'next_text' => '<i class="icon ion-ios7-arrow-right"></i>', 'type' => 'list' )); echo '</div> </div>'; } ?> ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ custom-uxbarn-portfolio.php template-pagination.php
  8. Hi, I'm Drew. I'm a web developer, primarily on the WordPress platform. I'm not a proficient PHP programmer but I can and have edited lots of PHP code to improve my sites. So, in a way, I'm learning PHP...the hard way. As probably is the case with most users, I'm here becuase I'd like help with some code and because I want to fasttrack my PHP education. I'll get to that eventually, this is just me introducing myself to the community. Best regards.
×
×
  • 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.