Simple Tips to Getting Approved on ThemeForest

1.debug true:

2.html, css, php, javascript coding standard maintain:

3.Prefix Everything:

For my WordPress themes, I use the themename_ prefix all around, as it is simple and clean.

<?php 
// Functions
function prefix_setup()

// Classes
class Prefix_Class {}

// Global Variables
global $prefix_passengers;

// Action Hooks
do_action( ‘prefix_start_engine’ );

// Filter Hooks
$register = apply_filters( prefix_register );

// Non Third-Pary Script Handles
wp_enqueue_script( 'prefix-functions', get_theme_directory_uri() . 'js/custom/functions.js' );

// Non Third-Pary Style Handles
wp_enqueue_style( 'prefix-minified-style', get_theme_directory_uri() . 'style.min.css' );

// Images
add_image_size( 'prefix-large', 800, 600 );
?>
		

4.Properly Include Scripts and Styles:

Do Not Prefix Third Party Scripts.

	
<?php
/**
 * Third Party Styles
 * More info: https://github.com/grappler/wp-standard-handles
 */
 
// Incorrect 
	wp_enqueue_style( 'prefix-font-awesome', get_template_directory_uri() . '/css/font-awesome.css', array(), '4.2.0', 'all' );

// Corrrect 
	wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css', array(), '4.2.0', 'all' );


/**
 * Third Party Scripts
 */
 
// Incorrect 
	wp_enqueue_script( 'prefix-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array( 'jquery' ), '1.1.1', true );

// Corrrect 
	wp_enqueue_script( 'jquery-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array( 'jquery' ), '1.1.1', true );
?>
	

5.Escape Everything:

	
<?php 

// Use anytime HTML element encloses a section of data:

	echo esc_html( $no_html );

// Use on all URLs, including those in the 'src' and 'href' attributes of an HTML element:

	<img src="<?php echo esc_url( $escaped_url ); ?>" />

// Use for inline Javascript:

	<a href="#" onclick="<?php echo esc_js( $escaped_js ); ?>">
		<?php esc_html__( 'Click Here', 'text-domain' ); ?>
	</a>

// Use for an HTML attribute:

	<div class="<?php echo esc_attr( $escaped_class ); ?>">
?>	
	

6.Check for PHP Errors and Warnings:

One of the easiest errors to check for is standard PHP errors. Enable wp_debug and go to town self-reviewing your theme to ensure there are no PHP errors, notices or warnings anywhere

7.Update TGMPA:

Keep in mind that every time you release a new version of your theme, you should double check that the latest version of TGMPA is included.

8.Properly Include Plugins Using TGMPA:

	
<?php
// Include a plugin from the WordPress Repository:
array(
  'name'      => esc_html__( 'WooCommerce', 'text-domain' ),
  'slug'      => 'woocommerce',
  'required'  => false,
),

// Include a plugin bundled within a WordPress theme:
array(
  'name'      => esc_html__( 'Example Plugin', 'text-domain' ),
  'slug'      => 'example-plugin',
  'source'    => get_template_directory() . '/inc/plugins/example-plugin.zip',
  'required'  => false,
),
?> 	

9.Disable TGMPA Force Actions:

Every user should have free rein to activate or deactivate any WordPress plugins installed on their website.

10.Theme Unit Test:

Common issues are table display errors, image alignments, responsive comments, pingbacks display errors, password-protected post styling issues, and search index mishaps.

11.Run Theme Check:

Theme Check is literally the easiest way to check your WordPress theme against the latest coding standards and techniques

12.html markup validation:

13.Provide Offline and online Documentation:

Having offline documentation ensures that your customers are not hanging when there is not an Internet connection available or when your files are inaccessible – for any reason.

Advertisements

WordPress Information

ওয়ার্ডপ্রেস টার্মিনোলজি

1.slug (mean user friendly url)
2.Template Hierarchy ( ওয়ার্ডপ্রেসে পাট্টিকুলারলি যদি কিছু ফাইল থাকে ওয়ার্ডপ্রেস আগে সেই ফাইলটা দিয়ে কন্টেন্ট দেখায়। যদি ওটা না থাকে তাহলে আরেকটা ফাইল দিয়ে চেক করে যে এ ফাইলটা আছে কিনা তখন সেটা দিয়ে কন্টেন্ট দেখায়। যদি সেটাও না থাকে তাহলে আরেকটা ফাইল দিয়ে কন্টেন্ট দেখায় এভাবে সবশেষে কেউ যদি না থাকে তাহলে index.php দিয়ে কন্টেন্ট দেখায়। এই যে ওর্ডারটা, কন্টেন্ট দেখানোর জন্য কোন টেমপেল্ট ফাইলটা লোড হবে কোন php ফাইলটা লোড হবে। এই ওর্ডারটাকেই বলা হয় Template Hierarchy )

3.Taxonomy And Terms (Categories, Tags)
4.Transient (Temporary Storage)

What is hook?

হুক আসলে জাস্ট একটা ইভেন্ট ব্রডকাস্টিং সিস্টেম। দুই রকমের হুক আছে, অ্যাকশন হুক এবং ফিল্টার হুক

প্লাগেবল ফাংশন কি?

একটা ফাংশনকে এমন ভাবে ডিফাইন করা হয়, যাতে করে ইউজার সেই ফাংশনটি রিরাইট করতে পারে। অথাৎ একটা কন্ডিশনের ভিক্তিতে চেক করা হয় ফাংশনটি লিখা হয়েছে কিনা? যদি না হয় তাহলে ফলবেক হিসেবে কারেন্ট ফাংশনটিকে রির্টান করে। আর যদি থাকে তার মানে সেই existing ফাংশনটিকে নতুন করে লিখা হয়েছে। তখন সে নতুনটাকে রির্টান করে।

Google Live Map

<?php

/*
Template Name: map
*/

get_header();

?>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCPj2rrgRVKPap-cVS9_Wpd4fkBkXGF7fI&callback=myMap"></script>

<style>
	.common_page_container {border-top: 1px dashed #dddddd;margin:14px auto;padding: 24px 0;}
	.outletadd {padding: 0 0 0 3%;width:36%;}
	.store-col {float: left;margin: 0;}
	.store-col li {background:#f6f6f6;border: 1px solid #ddd;list-style: none;margin: 0 0 6px;padding: 3px 6px;}
	.store-col a {text-decoration: none; font-size: 13px;}
	#map-add {font-size: 13px; font-family: arial;}
	.map-add.store-col {float: left;margin: 0px;width:100%;}
	#MapCanvas {margin: 0;  max-width: 100%;min-height:380px;min-width: 300px;padding: 0;}
</style>

<script type="text/javascript">
	function updateMap(selectControl){ 
	    switch(selectControl){
			case 'Shimanto': 
			  initialize(23.738143,90.376614, "1st Floor, Road no-2, Dhanmondi, Dhaka<br/>Phone:+8802-8618890");
			  addressChange("Shimanto Square: <br/> 1st Floor, Road no-2, Dhanmondi, Dhaka <br/>Mobile:+88-01730068075");
			  break; 
			  
			case 'Mohammadpur':
			  initialize(23.76508,90.358429, "Shop No. 223-224, Toyko Square, Japan Garden City <br/>Mobile:+88-01730068069");
			  addressChange("Mohammadpur: <br/>Shop No. 223-224, Toyko Square, Japan Garden City <br/>Mobile:+88-01730068069");
			  break;
		}
	}   


	function initialize(lat,Lng,titletxt) { 
	    var mapOptions = {
	      center: new google.maps.LatLng(lat,Lng),
	      zoom: 17
	    };

	    var map = new google.maps.Map(document.getElementById("MapCanvas"),mapOptions);
		
		var marker = new google.maps.Marker({
			position: new google.maps.LatLng(lat,Lng),
			map: map,
			icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png'
			//title: 'Rang'
		});

		var infowindow = new google.maps.InfoWindow({
		  content: titletxt,
		  zIndex: 990,
		});

		infowindow.open(map,marker);
	}

	function addressChange(add){
		document.getElementById('map-add').innerHTML = add;	
	}

	jQuery(document).ready( function($) {
		google.maps.event.addDomListener(window, 'load', initialize(24.1263456,90.3802059, "269-272 Tejgaon I/A Dhaka-1208, Bangladesh <br/>Tel: +88 02-8870616, 8870631<br/>"),check);	
	});
		
</script>



<div class="common_page_container">
	<div class="selectoutlet store-col">
		<ul>
			<li><a href="javascript:;" rel="Shimanto" onclick="updateMap(this.rel)">&nbsp; Shimanto Square</a></li>
			<li><a href="javascript:;" rel="Mohammadpur" onclick="updateMap(this.rel)">&nbsp; Mohammadpur</a></li>
			
		</ul>
		<!--<form>
			<select name="mapchange"  onchange="updateMap(this.options[this.selectedIndex].value)">
				<option value="Basundhara">&nbsp; Basundhara City</option>
				<option value="pink_city">&nbsp; Pink City</option>
				<option value="jamuna_future">&nbsp;Jamuna Future Park 1</option>
				<option value="jamuna_future2">&nbsp;Jamuna Future Park 2</option>
				
			</select>
		</form> -->
	</div>
	<div class="outletadd store-col">
		<div id="map-add">269-272 Tejgaon I/A Dhaka-1208, Bangladesh <br/>Tel: +88 02-8870616, 8870631<br/>E-mail: info@energypac-fashions.com</div>
	</div>
	<div class="map-add store-col">
		<div id="MapCanvas"></div>
	</div>
	<div class="clearer"></div>
</div>


<?php 
get_footer(); 

?>

Image uploading Problem

|| File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini file

|| solved: Go to the file directory public_html wp-admin then put the php.ini file, and include following code


upload_max_filesize = 64M;
post_max_size = 32M;
safe_mode = off;