What does PHP mean? Solutions

Source: Internet
Author: User
What does PHP mean?

if (defined (' Wp_use_themes ') && wp_use_themes):
$template = false;
if (is_404 () && $template = Get_404_template ()):
ElseIf (Is_search () && $template = Get_search_template ()):
ElseIf (Is_front_page () && $template = Get_front_page_template ()):
ElseIf (Is_home () && $template = Get_home_template ()):
ElseIf (is_post_type_archive () && $template = Get_post_type_archive_template ()):
ElseIf (Is_tax () && $template = Get_taxonomy_template ()):
ElseIf (Is_attachment () && $template = Get_attachment_template ()):
Remove_filter (' the_content ', ' prepend_attachment ');
ElseIf (Is_single () && $template = Get_single_template ()):
ElseIf (Is_page () && $template = Get_page_template ()):
ElseIf (Is_category () && $template = Get_category_template ()):
ElseIf (Is_tag () && $template = Get_tag_template ()):
ElseIf (Is_author () && $template = Get_author_template ()):
ElseIf (Is_date () && $template = Get_date_template ()):
ElseIf (is_archive () && $template = Get_archive_template ()):
ElseIf (Is_comments_popup () && $template = Get_comments_popup_template ()):
ElseIf (is_paged () && $template = Get_paged_template ()):
else:
$template = Get_index_template ();
endif
/**
* Filter The path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
if ($template = apply_filters (' template_include ', $template))
Include ($template);
Return
endif

------Solution--------------------
Very simple,&& in front of the judge-true/False, followed by the assignment, must be true
For reasons of shortcut, if the first half of && is false, the second half will not need to be judged.
That is, only the first half of the paragraph is judged to be true.
Because the purpose of the program is to assign values, there is no need for the actual statement after the colon.
------Solution--------------------
Can be understood as
It's a three-dimensional lazy notation.
$template = (is_404 ())? Get_404_template (): false;
Or
if (is_404 ()) $template = Get_404_template ();
else $template = false;
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.