Search cha con trong wordpress tưởng không dễ mà dễ không tưởng

<?php

$post_type

=

isset

(

$_GET

[

‘post_type’

]

)

&& $_GET[‘post_type’] ? $_GET[‘post_type’] : ‘post’;

$district

=

isset

(

$_GET

[

‘quan-huyen’

]

)

&& $_GET[‘quan-huyen’] ? $_GET[‘quan-huyen’] : ”;

$location

=

isset

(

$_GET

[

‘xa-phuong’

]

)

&& $_GET[‘xa-phuong’] ? $_GET[‘xa-phuong’] : $district;

$key

=

isset

(

$_GET

[

‘s’

]

)

&& $_GET[‘s’] ? $_GET[‘s’] : ”;

$args

=

array

(

‘showposts’

=

>

10

,

‘post_type’

=

>

$post_type

,

‘s’

=

>

$key

,

‘khu-vuc’

=

>

$location

)

;

?>

<?php

$the_query

=

new

WP_Query

(

$args

)

;

?>

<?php

if

(

$the_query

>

have_posts

(

)

)

:

?>

<?php

while

(

$the_query

>

have_posts

(

)

)

:

$the_query

>

the_post

(

)

;

?>

<

p

>

<?php

the_title

(

)

;

?>

<

/

p

>

<?php

endwhile

;

?>

<?php

endif

;

?>

<?php

wp_reset_query

(

)

;

?>