AffiliateBoard Dropdown Problem

Hi again!

This time i get a question from my friend Elisa from US about a problem she have regarding AffiliateBoard theme. This theme have a unique function that can help you to attach an affiliate post into a page.

Logically you can add any affiliate post type into the page, but the fact is only the latest 5 affiliate post types you can add. The question now is, how if you have more than 5 affiliate post types and you want to add the sixth into the page?

add affiliate

For example, you can check the screenshot above. I have 9 affiliate post types but only the latest 5 that displayed.

To fix it, you can modify a file named theme-functions.php and find out this code:

<?php 
								//Access the WordPress Pages via an Array
								$colabs_post = array();
								$colabs_post_obj = get_posts("post_type=affiliate");    
								foreach ($colabs_post_obj as $colabs_page) {
									echo '<option value="'.$colabs_page->ID.'" >'.$colabs_page->post_title.'</option>';
								}	
							?>	

Edit the code become:

<?php 
								//Access the WordPress Pages via an Array
								$colabs_post = array();
								$colabs_post_obj = get_posts("post_type=affiliate&posts_per_page=10");    
								foreach ($colabs_post_obj as $colabs_page) {
									echo '<option value="'.$colabs_page->ID.'" >'.$colabs_page->post_title.'</option>';
								}	
							?>

And it is done! Right now it will displaying the latest 5 affiliate post types. You can also change the number ’10’ become any number you want. For example 30 or 50.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s