*/
function miproduct_save_meta() {
global $post;
- if ( !wp_verify_nonce( $_POST['miproductmeta-meta-noncename'], 'miproductmeta-meta-noncename' ) ) {
+ if ( ! wp_verify_nonce( $_POST['miproductmeta-meta-noncename'], 'miproductmeta-meta-noncename' ) ) {
return $post->ID;
}
- if ( !current_user_can( 'edit_post', $post->ID ) ) {
+ if ( ! current_user_can( 'edit_post', $post->ID ) ) {
return $post->ID;
}
$features = filter_var( $_POST['miproduct_features'], FILTER_SANITIZE_STRING );
* Add shortcode function. This will call the correct function based on the
* front end search.
*
- * @param mixed $atts
+ * @param mixed $atts Attribute array.
* @access public
- * @return void
+ * @return type
*/
function michsci_shortcode( $atts ) {
extract( shortcode_atts( array( 'limit' => '10' ), $atts ) );
$cat_id = $product_category->term_id;
}
}
- $term = get_term_by( 'id', $_REQUEST[ MICHSCI_CATEGORY_NAME ],'michsci_category' );
+ $term = get_term_by( 'id', $_REQUEST[ MICHSCI_CATEGORY_NAME ], 'michsci_category' );
$name = $term->name;
if ( ! $name ) {
function michsci_list_products( $text_query ) {
global $wpdb, $wp;
+ // TODO: $cat_id is not initialized!
$cat = get_term( $cat_id, MICHSCI_CATEGORY_NAME );
$args = array(
'posts_per_page' => -1,
);
}
- $products = get_posts( $args );
+ $products = get_posts( $args );
$total_products = count( $products );
- $current_url = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
- $iterator = 1;
+ $current_url = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
+ $iterator = 1;
foreach ( $products as $product ) {
$product_terms = wp_get_post_terms( $product->ID, MICHSCI_CATEGORY_NAME, 'name' );
*
* Create a list of categories.
*
- * @param bool $cat_id Category id.
+ * @param bool $cat_id Parent Category to Display.
*
* @access public
* @return void
$term = get_terms(
MICHSCI_CATEGORY_NAME,
array(
- 'child_of' => $cat_id,
- 'hide_empty' => true,
+ 'child_of' => $cat_id,
+ 'hide_empty' => true,
)
);
include 'views/category_detail.php';