[Plugin: Widget Logic] Create a function to use in widget logic using string
-
I am aiming to check if my search is for a certain custom post type (objects) or not, and dsiplay a different search template – but alss different widgets.
I check like this for the template:<?php // Checks on the search string, and then sends to either all or object search $is_post_type = $_GET['post_type']; if ('objects' == $is_post_type ) include( 'search-objects.php'); else include( 'search-all.php'); ?>Now for widget logic to be able to display the right widget, I try create a function in functions.php:
function is_objects_search() { $is_objects_search = $_GET['post_type']; if ('objects' == $is_post_type ) return true; else return false; }But when I put is_objects_search() in widget logic, it does not display 🙁
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘[Plugin: Widget Logic] Create a function to use in widget logic using string’ is closed to new replies.