Title: Help with php function
Last modified: August 20, 2016

---

# Help with php function

 *  [Steve](https://wordpress.org/support/users/stif/)
 * (@stif)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/help-with-php-function/)
 * Hi I’m trying to make a function to add a woocommerce sort by drop down appear
   on a specific shop page (the main shop page only (id=655)).
 *     ```
       function addDropDown()
       	{
   
       		global $wp_query;
       		$pageid = $post->ID;
   
       		if($pageid=655)
       		{
       			add_action( 'woocommerce_before_main_content', 'woocommerce_catalog_ordering', 20 );
       		}
       	}
       	add_action('init', 'removeDropDown');
       ```
   
 * I use `add_action( 'woocommerce_before_main_content', 'woocommerce_catalog_ordering',
   20 );` to add the drop down menu to the shop pages. However it appears on the
   shop page and the single product page.
 * Even if i change `if($pageid=655)` to `if($pageid=6)` the drop down appears on
   both the shop page and single product page!
 * Help please!

The topic ‘Help with php function’ is closed to new replies.

## Tags

 * [php function](https://wordpress.org/support/topic-tag/php-function/)

 * 0 replies
 * 1 participant
 * Last reply from: [Steve](https://wordpress.org/support/users/stif/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/help-with-php-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
