This topic contains 2 replies, has 2 voices, and was last updated by Georgergb75 2 years, 5 months ago.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Hide published date for Pages
This topic contains 2 replies, has 2 voices, and was last updated by Georgergb75 2 years, 5 months ago.
Hi,
I have found the setting where I can choose whether to show the published date in results.
However, I was wondering if there is anyway of refining this. I don’t want to show the published date for Pages as this is not really relevant but I do need it for Posts where it is important.
Is there anyway of altering this?
Many thanks
George
Hi George,
With a simple custom code it might be doable, by unsetting the date for the page post type results. Using the asp_results hook, something like this:
add_filter( 'asp_results', 'asp_remove_date_from_pages', 10, 1 );
function asp_remove_date_from_pages( $results ) {
foreach ($results as $k=>&$r) {
if ( isset($r->post_type) && $r->post_type == 'page' ) {
$r->date = '';
}
}
return $results;
}
Best,Hi Ernest,
Thank you very much for the advice and responding so quickly.
Best
George
You must be logged in to reply to this topic.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |