Skip to content

Instantly share code, notes, and snippets.

@kprajapatii
Created November 9, 2016 06:54
Show Gist options
  • Save kprajapatii/4be78638f8fbb5beedcb69b3f5b8985a to your computer and use it in GitHub Desktop.
Save kprajapatii/4be78638f8fbb5beedcb69b3f5b8985a to your computer and use it in GitHub Desktop.
Filter the linked cpt widget settings .
<?php // YOU MOST LIKELY DON'T NEED THIS LINE, SO DON'T COPY PASTE THIS LINE WITH BELOW CODE
/***** CODE STARTS HERE *****/
// Filter the linked cpt layout.
function geodirectory_cpt_linked_listing_view( $layout ) {
$layout = 'gridview_onehalf'; // one of gridview_onehalf, gridview_onethird, gridview_onefourth, gridview_onefifth, listview
return $layout;
}
add_filter( 'geodir_cpt_linked_listing_view', 'geodirectory_cpt_linked_listing_view', 10, 1 );
// Filter the linked cpt sorting.
function geodirectory_cpt_linked_sortby( $sortby ) {
$sortby = 'high_rating'; // one of latest, featured, high_review, high_rating, random, nearest
return $sortby;
}
add_filter( 'geodir_cpt_linked_sortby', 'geodirectory_cpt_linked_sortby', 10, 1 );
// Filter the linked cpt no. of listings.
function geodirectory_cpt_linked_count( $post_number ) {
$post_number = 6; // any integer
return $post_number;
}
add_filter( 'geodir_cpt_linked_count', 'geodirectory_cpt_linked_count', 10, 1 );
// Filter the linked cpt character count.
function geodirectory_cpt_linked_post_excerpt( $character_count ) {
$character_count = 200; // any integer
return $character_count;
}
add_filter( 'geodir_cpt_linked_post_excerpt', 'geodirectory_cpt_linked_post_excerpt', 10, 1 );
/***** CODE ENDS HERE *****/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment