Bootstrap Templates Bundle

Monday, June 8, 2015

Themeforest WordPress Soft-Rejection Reasons

1. Prefix all your custom functions/variables/classes. A good rule of thumb is to prefix everything with your theme initials and your own initials. http://nacin.com/2010/05/11/in-wordpress-prefix-everything/
Example: http://envato.d.pr/11iFB/2zF1qyXn

2. http://envato.d.pr/70LX/2xoO6dxY

3. http://envato.d.pr/17o9S/1UqGOmZs

4. http://envato.d.pr/1fL0r/2A22MSZv


5. http://envato.d.pr/1iP7G/1X6FL8kV -
How to test the blog/posts layout/functionality - Import the Theme Unit Test [http://codex.wordpress.org/Theme_Unit_Test] file and make sure that:

- Posts display correctly, with no apparent visual problems or errors.
- Posts display in correct order.
- Page navigation displays and works correctly.
- As "sticky posts" are a core feature, the theme should style and display them appropriately.
- Lack of body text should not adversely impact the layout.
- Theme must incorporate both the "Tag" and the "Category" taxonomies in some manner.
- Floats are cleared properly for floated element (thumbnail image) at the end of the post content.



Reference link: https://wpthemetestdata.wordpress.com/

6. Make sure the CSS file is well documented with proper table of contents. ex:http://www.smashingmagazine.com/2008/05/02/improving-code-readability-with-css-styleguides/

7. Data Validation issues have been found in your theme. All dynamic data must be correctly escaped for the context where it is rendered.

- http://codex.wordpress.org/Data_Validation
- http://developer.wordpress.com/themes/escaping/
- https://vip.wordpress.com/2014/06/20/the-importance-of-escaping-all-the-things/

8.Please perform a global search for "echo $" and escape ALL outputs. This will ensure there are no security issues.

9. wp_reset_query - if you’re not using query_posts(), then you really shouldn’t be messing with the main $wp_query variable, as wp_reset_query() does.

10.query_posts() will change your main query and is not recommended. Only use if absolutely necessary
http://codex.wordpress.org/Function_Reference/wp_reset_query

11.Try wp_reset_postdata() instead.


12. http://envato.d.pr/1exQQ/2CmMfYiq

13. http://envato.d.pr/19YIF/5oxYvi8p

14 Prefix all your custom functions/variables/classes. A good rule of thumb is to prefix everything with your theme initials and your own initials. http://nacin.com/2010/05/11/in-wordpress-prefix-everything/

15. wp_reset_query - if you’re not using query_posts(), then you really shouldn’t be messing with the main $wp_query variable, as wp_reset_query() does.

16. query_posts() will change your main query and is not recommended. Only use if absolutely necessary
http://codex.wordpress.org/Function_Reference/wp_reset_query

17. Try wp_reset_postdata() instead.

18.  Make sure all the WP default widgets display properly in all widgetized areas. You can check with monster widgets plugin.

19.  Custom widget areas must use the safety condition “is_active_sidebar” to ensure no naming conflict with other plugins.


20. Please perform a global search for "echo $" and you will see several issues.




22. http://envato.d.pr/1b4st/Zxkry5eR

23. index.php should be reserved for default blogroll and if there is no static page being set as front page, it should display the blogroll on homepage. You can use a custom page template for homepage.

http://codex.wordpress.org/Theme_Development#Index_.28index.php.29

24. Display a list of posts in excerpt or full-length form. Choose one or the other as appropriate.
Include wp_link_pages() to support navigation links within posts.
http://envato.d.pr/1jlxA/5HWBWlOx

25. Logo should link to blog feed/index page.

26. No space between paragraphs. http://envato.d.pr/1d4O6/5z2D59V8

27. Data Validation issues have been found in your theme. All dynamic data must be correctly escaped for the context where it is rendered.

- http://codex.wordpress.org/Data_Validation
- http://developer.wordpress.com/themes/escaping/
- https://vip.wordpress.com/2014/06/20/the-importance-of-escaping-all-the-things/

Please perform a global search for "echo $" and you will see several issues.

28. Your theme does not support drop down menus. Please state this in your item description.



30. All dynamic data must be correctly escaped for the context where it is rendered.

- http://developer.wordpress.com/themes/escaping/
- https://vip.wordpress.com/2014/06/20/the-importance-of-escaping-all-the-things/
- https://css-tricks.com/introduction-to-wordpress-front-end-security-escaping-the-things/

31. wp_footer needs to be immediately before the end of the body tag. http://codex.wordpress.org/Function_Reference/wp_footer

32. All theme logic belongs in functions.php

33. Remove this: http://envato.d.pr/16VqL/5G9XtcGy

34. Prefix all your custom functions, variables, classes, etc. A good rule of thumb is to prefix everything with your theme initials and your own initials. Read more: http://nacin.com/2010/05/11/in-wordpress-prefix-everything/

35. Import the Theme Unit Test [http://codex.wordpress.org/Theme_Unit_Test] file and make sure that:

- Posts display correctly, with no apparent visual problems or errors.
- Posts display in correct order.
- Page navigation displays and works correctly.
- The search results page displays properly, with search query results displayed.
- As "sticky posts" are a core feature, the theme should style and display them appropriately.
- "Read More" link works properly (links to single post at "<!--more-->" tag location).
- If theme supports post format type, post displays as intended in the index view.
- Lack of body text should not adversely impact the layout.
- Theme must incorporate both the "Tag" and the "Category" taxonomies in some manner.
- Floats are cleared properly for floated element (thumbnail image) at the end of the post content.
- Look for potential overflow issues if the theme has a small title area matched with a long non-breaking string.

37. Comments do not appear. http://envato.d.pr/17RFs/500q8jOw



Tuesday, May 19, 2015

Themeforest HTML Soft-Rejection Reasons

1. Please avoid trailing commas at the end of JS Objects. For example: { value_1: 5, value_2: 5, };

2. Make sure the CSS file is well documented with proper table of contents. ex:http://www.smashingmagazine.com/2008/05/02/improving-code-readability-with-css-styleguides/


3. There is a lot of redundant code in your JavaScript. For example, the following:

http://envato.d.pr/1hm91

There are multiple uses of SEAFs that all pass in the $. These can all be remove and replaced with a single SEAF.

4. http://envato.d.pr/1baOJ Avoid trailing commas in JS objects
http://envato.d.pr/15n6U
There are multiple version of jquery included in this item, please only include a single version of jquery.

5. Some of your files contain validation errors that will need to be fixed. Please be sure that all files validate before resubmitting.
You can validate HTML at http://validator.w3.org

6. Your jQuery code can benefit from some performance tweaks. Please read:http://code.tutsplus.com/tutorials/10-ways-to-instantly-increase-your-jquery-performance--net-5551

7. 404 error in any link.  Check Browser Console. http://envato.d.pr/1hwqh/2fZnA9LU

8. Please use "nav" tags for all navigation in the template.
http://www.html-5-tutorial.com/nav-element.htm

9. Parts of your design are either difficult to read or have contrast issues. Please make sure all sections of your design have adequate contrast and all text is easily readable.

10. Please delete the images from the main file and replace them with placeholders. http://placehold.it - Please mention this in the item description so buyers understand that they are not included in the download.

11. JavaScript files need to be placed at the bottom, barring critical exclusion. [Modernizr, for instance]

12. There are currently redundant events in your JavaScript. For example, you have multiple $(document).ready() events or multiple $(window).load() events. Please consolidate all code that should occur within a single event.

13. Consider using the preferred .on() rather than .click(), .bind(), .hover(), etc.

14. All JavaScript should be written with “use strict” mode on.

15. Your jQuery code can benefit from some performance tweaks. Please read: http://code.tutsplus.com/tutorials/10-ways-to-instantly-increase-your-jquery-performance--net-5551

16. Please have the original author open a support ticket to verify the partnership. Reference the ticket ID when resubmitting. (If the original item author is different person)

17. There is excessive blank space between your code blocks. Please fix this. http://envato.d.pr/1fwqV/5GdnjUPA

18. Inline CSS is not permitted. Please remove all inline CSS.




For WordPress Soft rejection: http://hasibtutorial.blogspot.com/2015/06/themeforest-wordpress-soft-rejection.html

How to add frontend post / content addition option in WordPress

Step 1. Create a new page with this page template
Step 2. Fill the form, to create a post
Step 3. Check Dashboard, post added or not.

Note: You can change post type and status from here

  1.  'post_type' => 'post',
  2.  'post_status' => 'publish'





  1. <?php
  2. /**
  3.  * Template Name: Front End Submission
  4.  */
  5. get_header(); ?>
  6. <div id="primary" class="site-content">
  7.         <div id="content" role="main">
  8.                 <?php
  9.                 /*
  10.                  * If sent, analyze form data and store them in variables
  11.                  */
  12.                 if (isset($_POST['submit'])) {
  13.                         $name = htmlspecialchars($_POST['myname']);
  14.                         $email = sanitize_email($_POST['myemail']);
  15.                         $message = wp_kses_post($_POST['mymessage']);
  16.                 /*
  17.                  * Create a post for post type "post"
  18.                  */
  19.                 $contact_post = array(
  20.                         'post_title' => $name . ' | ' . $email,
  21.                         'post_content' => $message,
  22.                         'post_type' => 'post',
  23.                         'post_status' => 'publish'
  24.                 );
  25.                 if (wp_insert_post($contact_post)) echo 'Post Added for admin review.<br>';
  26.                 else echo 'Try again: fill the fields';
  27.                 /*
  28.                  * Displaying the basic form
  29.                  */
  30.                 } else { ?>
  31.                         <form action="<?php echo the_permalink(); ?>" method="post">
  32.                                 <label for="name">Nom complet</label>
  33.                                 <input type="text" name="myname" id="name" placeholder="Votre nom" />
  34.                                 <hr>
  35.                                 <label for="email">Adresse e-mail</label>
  36.                                 <input type="email" name="myemail" id="email" placeholder="Votre e-mail" />
  37.                                 <hr>
  38.                                 <label for="message">Message</label>
  39.                                 <textarea cols="50" rows="10" name="mymessage" id="message" placeholder="Votre message..."></textarea>
  40.                                 <br>
  41.                                 <input type="submit" name="submit" value="Envoyer votre message" />
  42.                         </form>
  43.                 <?php } ?>
  44.         </div><!-- #content -->
  45. </div><!-- #primary -->
  46. <?php get_sidebar(); ?>
  47. <?php get_footer(); ?>

Sunday, April 19, 2015

How to show number of items in cart and total in WordPress Header or Menu Section



Add this code to you Functions.php file 


//check if woocommerce plugin is activated
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
function is_woocommerce_activated() {
if ( class_exists( 'woocommerce' ) ) {
return true;
}
else {
return false;
}
}
}


//showing cart header menu item
function andro_cart_menu_item() {
if(is_woocommerce_activated()){
?>

<li class="border"><a class="cart collapsed" data-target=".shopping-bag" href="javascript:;">
<span class="cart-icon"><?php esc_attr_e('Cart','andro');?></span>

<?php
global $woocommerce;
$my_cart_count = $woocommerce->cart->cart_contents_count;

echo '<span class="cart-number-box';
if ($my_cart_count > 0) {
echo ' active';
}
echo '">';echo sprintf( _n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count );
echo '</span>';
?>
</a></li>
<?php }
}

function andro_cart_shopping_bag(){
if(is_woocommerce_activated()){
?>
<div class="shopping-bag">
<?php
if ( version_compare( WOOCOMMERCE_VERSION, "2.0.0" ) >= 0 ) {
the_widget( 'WC_Widget_Cart', 'title=' );
} else {
the_widget( 'WooCommerce_Widget_Cart', 'title=' );
} ?>
</div>
<?php
}
}

add_filter( 'add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );

if ( ! function_exists( 'woocommerce_header_add_to_cart_fragment' ) ) {
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>

<?php
echo '<span class="cart-number-box';
$my_cart_count = $woocommerce->cart->cart_contents_count;
if ($my_cart_count > 0) {
echo ' active';
}
echo '">';
?>
<?php
echo sprintf( _n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count );
?></span>


<?php

$fragments['span.cart-number-box'] = ob_get_clean();

return $fragments;
} // End woocommerce_header_add_to_cart_fragment()
}



After that add this code to your header.php 

To show the cart count:
<?php echo sprintf (_n( '%d item', '%d items', $woocommerce->cart->cart_contents_count ), $woocommerce->cart->cart_contents_count ); ?> - <?php echo $woocommerce->cart->get_cart_total(); ?>

or 

<?php if (class_exists('Woocommerce')) {andro_cart_menu_item();} ?>


To show the cart bag or cart Widget: 

<?php  if (class_exists('Woocommerce')) {andro_cart_shopping_bag();} ?>


Sample Header: 

<div class="top-cart">
<div id="cart" class="btn-group btn-block">
<button type="button" data-toggle="dropdown" data-loading-text="Loading..." class="btn btn-inverse btn-block btn-lg dropdown-toggle">
<span class="top-cart-contain">
<span class="title-cart"></span>
<span id="cart-total">

<?php echo sprintf (_n( '%d item', '%d items', $woocommerce->cart->cart_contents_count ), $woocommerce->cart->cart_contents_count ); ?> - <?php echo $woocommerce->cart->get_cart_total(); ?>

<?php if (class_exists('Woocommerce')) {andro_cart_menu_item();} ?>
</span>
<i class="fa fa-caret-down"></i>
</span>
</button>


<ul class="dropdown-menu pull-right">
<li class="arrow-cart"></li>
<li>
<?php  if (class_exists('Woocommerce')) {andro_cart_shopping_bag();} ?>
</li>
</ul>
</div>
</div>

Monday, April 6, 2015

Add a custom tab to woocommerce single product page

Add this below code to your functions.php file. Then chnage the line that shows

echo '<p>Here\'s your new product tab.</p>';

You can create a meta field for single product and echo that field here.

echo '<p>Your Meta box output code here</p>';




add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {

// Adds the new tab

$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);

return $tabs;

}
function woo_new_product_tab_content() {

// The new tab content

echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';

}




#Use the following snippet to change the tab order

add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {

$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third

return $tabs;
}

Saturday, April 4, 2015

How to Override woocommerce widgets

Here, I tried to show how to override WooCommerce Price Filter widget.

At first Add this below code to your functions.php file.  copy the  class-wc-widget-price-filter.php   file from wp-content\plugins\woocommerce\includes\widgets  to your theme file and include that by
include_once  or include get_template_directory()


/*-------------------------------
 Override woocommerce product categories widgets
---------------------------------*/

add_action( 'widgets_init', 'override_woocommerce_widgets', 15 );

function override_woocommerce_widgets() {
  // Ensure our parent class exists to avoid fatal error

    if ( class_exists( 'WC_Widget_Price_Filter' ) ) {
    unregister_widget( 'WC_Widget_Price_Filter' );

    include_once( 'inc/custom-widgets/fengo-class-wc-widget-price-filter.php' ); 
//or 
//include get_template_directory() . '/inc/custom-widgets/fengo-class-wc-widget-price-filter.php';

    register_widget( 'Fengo_WC_Widget_Price_Filter' );
  }    

}

Wokiee React eCommerce Template