Is in WordPress Theme_ Home () and is_ front_ Different usage of page ()

Under normal circumstances, when we use WordPress to build a website, the home page is the default index.php Just call the template. But if there are some special needs, such as the special page needs to be displayed in the home page, we will set a static page in the background as the home page. At this time, we may need to Header.php Determine the title in the template file.

Here you need to be familiar with two function applications:

is_ Home() / / indicates normal display of the home page

is_ front_ Page () / / indicates whether to use a custom static page as the first page


<?php if ( is_ front_ Page ()) {?>custom static page first page title <& Title>;? PHP}?></p> </blockquote> <p>In this way, the above code can be used when customizing title. </p> <div class="related-post grid"> <div class="headline" >Related Article</div> <div class="post-list "> <div class="item"> <a class="title post_title" post_title="" href="" data-wpel-link="internal"> WordPress automatically intercepts part of the content of the article as a summary </a> <p class="excerpt post_excerpt"> In the daily release of articles, not every article may have an article summary, so the summary function of WordPress <a post_excerpt="" class="read-more" href="" data-wpel-link="internal"> Read more</a> </p> </div> <div class="item"> <a class="title post_title" post_title="" href="" data-wpel-link="internal"> Implementation of tag inner chain association effect of WordPress program without plug-in </a> <p class="excerpt post_excerpt"> Nowadays, whether it is a large website or a personal blog, what matters is not the weight of the website <a post_excerpt="" class="read-more" href="" data-wpel-link="internal"> Read more</a> </p> </div> <div class="item"> <a class="title post_title" post_title="" href="" data-wpel-link="internal"> How to delete the version number tail of WordPress scripts and CSS style sheets </a> <p class="excerpt post_excerpt"> As an excellent website building program, WordPress is undoubtedly the largest user group in the world in terms of user <a post_excerpt="" class="read-more" href="" data-wpel-link="internal"> Read more</a> </p> </div> <div class="item"> <a class="title post_title" post_title="" href="" data-wpel-link="internal"> Solve the problem of “upload error, please try again later” in WordPress image upload </a> <p class="excerpt post_excerpt"> One of the reasons why I like to use WordPress is that I have encountered problems. Basically, I can find <a post_excerpt="" class="read-more" href="" data-wpel-link="internal"> Read more</a> </p> </div> </div> <script> </script> <style type="text/css"> .related-post{} .related-post .post-list{ text-align:left; } .related-post .post-list .item{ margin:10px; padding:0px; } .related-post .headline{ font-size:1.5rem !important; color:#333333 !important; } .related-post .headline{ font-family: "Fira Sans Condensed",serif; font-weight:normal !important; border-bottom:1px solid #ccc; margin-top: 30px !important; margin-bottom: 0px !important;} .related-post .post-list .post_title{ color:#0085ba !important; font-size:1.2rem !important;} .related-post .post-list .item .post_excerpt{ font-size:1rem !important;} .related-post .post-list .item{ width:100% !important; margin:0px 0 10px 0 !important; border-bottom:1px dashed #ccc; } .related-post .post-list .item .post_thumb{ display:none !important;} .related-post .post-list .item .post_excerpt .read-more:before { font-family: 'FontAwesome'; content: '\f0a4'; margin: 0 5px 0 0; color: #FF6600; font-size: 1; margin-left:10px; margin-right:5px } .related-post .post-list .item .post_title{ font-size:16px; color:#3f3f3f; margin:10px 0px; padding:0px; display: block; text-decoration: none; } .related-post .post-list .item .post_thumb{ max-height:220px; margin:10px 0px; padding:0px; display: block; } .related-post .post-list .item .post_excerpt{ font-size:13px; color:#3f3f3f; margin:10px 0px; padding:0px; display: block; text-decoration: none; } @media only screen and (min-width: 1024px ){ .related-post .post-list .item{ width: 45%; } } @media only screen and ( min-width: 768px ) and ( max-width: 1023px ) { .related-post .post-list .item{ width: 90%; } } @media only screen and ( min-width: 0px ) and ( max-width: 767px ){ .related-post .post-list .item{ width: 90%; } } </style> </div> <div class="clearfix"></div> </div> <footer class="entry-footer mt-3 pt-12px border-top small"> <span class="mr-2"><i class="fa fa-folder-open" aria-hidden="true"></i> <a href="" rel="category tag" data-wpel-link="internal">Wordpress Guide</a></span><span class="mr-2"><i class="fa fa-tags" aria-hidden="true"></i><a href="" rel="tag" data-wpel-link="internal">is_ front_ page()</a>, <a href="" rel="tag" data-wpel-link="internal">is_ Home ()</a>, <a href="" rel="tag" data-wpel-link="internal">WordPress</a>, <a href="" rel="tag" data-wpel-link="internal">WordPress skills</a></span> </footer> </article> <nav class="container-fluid navigation post-navigation mt-12px mb-3"> <h2 class="sr-only">Post navigation</h2> <div class="row nav-links"> <div class="col px-0 py-12px border-top border-bottom nav-previous"><i class="fa fa-angle-double-left" aria-hidden="true"></i> <a href="" rel="prev" data-wpel-link="internal">How to delete the version number tail of WordPress scripts and CSS style sheets</a></div><div class="col px-0 py-12px border-bottom border-top nav-next text-right"><a href="" rel="next" data-wpel-link="internal">Set the method for WordPress website to specify that the classified content will not be displayed on the home page</a> <i class="fa fa-angle-double-right" aria-hidden="true"></i></div> </div><!-- .nav-links --> </nav><!-- .navigation --> <div class="comments-area" id="comments"> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/wordpress-guide/107.html#respond" style="display:none;" data-wpel-link="internal">Cancel reply</a></small></h3> <form action="" method="post" id="commentform" class="comment-form" novalidate> <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> Required fields are marked <span class="required">*</span></p><div class="form-group comment-form-comment"> <label for="comment">Comment <span class="required">*</span></label> <textarea class="form-control" id="comment" name="comment" aria-required="true" cols="45" rows="8"></textarea> </div><div class="form-group comment-form-author"><label for="author">Name <span class="required">*</span></label> <input class="form-control" id="author" name="author" type="text" value="" size="30" aria-required='true'></div> <div class="form-group comment-form-email"><label for="email">Email <span class="required">*</span></label> <input class="form-control" id="email" name="email" type="email" value="" size="30" aria-required='true'></div> <div class="form-group comment-form-url"><label for="url">Website</label> <input class="form-control" id="url" name="url" type="url" value="" size="30"></div> <div class="form-group form-check comment-form-cookies-consent"><input class="form-check-input" id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /> <label class="form-check-label" for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment</label></div> <p class="form-submit"><input name="submit" type="submit" id="submit" class="btn btn-primary" value="Post Comment" /> <input type='hidden' name='comment_post_ID' value='107' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </p> <div style="display:block;" id="secureimgdiv"> <p><label for="cas_fieldname">Anti-spam word: (Required)</label><span style="color:#FF0000;">*</span><br /> <small>To prove you're a person (not a spam script), type the security word shown in the picture.</small><br /> <input type="text" name="871da162ade0cf025b82c0918e1a02cd" id="cas_fieldname" style="max-width:120px; width:120px; display:inline-block;" size="30" /> <input id="cas_match" type="hidden" name="matchthis" value="" /> <img id="cas_image" style="border:none; cursor:pointer;" onclick="newAntiSpam();" src="" alt="Anti-spam image" style="border:1px solid black;vertical-align:top;height:50px;width:160px;" /></p> </div> <script type='text/javascript'> <!-- var commentinput = document.getElementById("comment").parentNode; var submitp = commentinput.parentNode; var substitution2 = document.getElementById("secureimgdiv"); submitp.insertBefore(substitution2, commentinput); // --> </script> <script type="text/javascript"> // Code modified from Peter's ajax date script at // The date script modified code from a tutorial here: var casTime = new Date();// Update the code that displays the anti-spam image var url = "" + casTime.getTime(); // The server-side script function handleHttpResponse() { if (http.readyState == 4) { if (http.responseText.indexOf('invalid') == -1) { results = http.responseText.split( '-' ); document.getElementById('cas_match').value = results[0]; document.getElementById('cas_fieldname').name = results[1]; document.getElementById('cas_image').src = '' + results[0]; isWorking = false; } } } var isWorking = false; // Call up the script that generates the new id function newAntiSpam() { if (!isWorking && http) {"GET", url, true); http.onreadystatechange = handleHttpResponse; isWorking = true; http.send(null); } }function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); // We create the HTTP Object newAntiSpam(); </script> </form> </div><!-- #respond --> </div><!-- #comments --> </main><!-- #main --> <div class="mb-3 border-bottom d-block d-md-none"></div> <!-- Do the right sidebar check --> </div><!-- #closing the primary container from /global-templates/left-sidebar-check.php --> <div class="col-sm-6 col-md-4 col-lg-3 col-xxl-2 widget-area order-3" id="right-sidebar" role="complementary"> <aside id="search-2" class="widget mb-3 pb-3 border-bottom widget_search"> <form method="get" id="searchform" action="" role="search"> <label class="sr-only" for="s">Search</label> <div class="input-group"> <input class="field form-control" id="s" name="s" type="text" aria-label="Search input" placeholder="Search …" value=""> <span class="input-group-append"> <button class="submit btn btn-primary" id="searchsubmit" type="submit" aria-label="Search submit"><i class="fa fa-search" aria-hidden="true"></i></button> </span> </div> </form> </aside> <aside id="recent-posts-2" class="widget mb-3 pb-3 border-bottom widget_recent_entries"> <h2 class="widget-title">Recent Posts</h2> <ul> <li> <a href="" data-wpel-link="internal">WordPress automatically intercepts part of the content of the article as a summary</a> </li> <li> <a href="" data-wpel-link="internal">How to add user defined upload avatar function in WordPress</a> </li> <li> <a href="" data-wpel-link="internal">How to get the number of articles and comments of the current logined user in WordPress</a> </li> <li> <a href="" data-wpel-link="internal">WordPress tips: get statistics of the number of pictures in the article</a> </li> <li> <a href="" data-wpel-link="internal">WordPress details optimization to automatically add ALT and title information to the article image</a> </li> </ul> </aside><aside id="recent-comments-2" class="widget mb-3 pb-3 border-bottom widget_recent_comments"><h2 class="widget-title">Recent Comments</h2><ul id="recentcomments"><li class="recentcomments"><span class="comment-author-link">Landing</span> on <a href="" data-wpel-link="internal">What all junior WordPress developers should know</a></li><li class="recentcomments"><span class="comment-author-link">wpfans</span> on <a href="" data-wpel-link="internal">Add “click to load more articles” function implementation method for WordPress theme</a></li><li class="recentcomments"><span class="comment-author-link">Paul</span> on <a href="" data-wpel-link="internal">Add “click to load more articles” function implementation method for WordPress theme</a></li><li class="recentcomments"><span class="comment-author-link">Peter</span> on <a href="" data-wpel-link="internal">Add “click to load more articles” function implementation method for WordPress theme</a></li></ul></aside><aside id="archives-2" class="widget mb-3 pb-3 border-bottom widget_archive"><h2 class="widget-title">Archives</h2> <ul> <li><a href="" data-wpel-link="internal">March 2021</a></li> <li><a href="" data-wpel-link="internal">February 2021</a></li> </ul> </aside><aside id="categories-2" class="widget mb-3 pb-3 border-bottom widget_categories"><h2 class="widget-title">Categories</h2> <ul> <li class="cat-item cat-item-59"><a href="" title="Web Programming" data-wpel-link="internal">Web Programming</a> </li> <li class="cat-item cat-item-1"><a href="" title="Wordpress Guide" data-wpel-link="internal">Wordpress Guide</a> </li> <li class="cat-item cat-item-32"><a href="" title="Wordpress News" data-wpel-link="internal">Wordpress News</a> </li> <li class="cat-item cat-item-3"><a href="" title="Wordpress Plugins" data-wpel-link="internal">Wordpress Plugins</a> </li> <li class="cat-item cat-item-142"><a href="" title="Wordpress Template Tags" data-wpel-link="internal">Wordpress Template Tags</a> </li> </ul> </aside> </div><!-- #right-sidebar --> </div><!-- .row --> </div><!-- #content --> </div><!-- #single-wrapper --> <!-- ******************* The Footer Full-width Widget Area ******************* --> <div class="pt-4 pb-2" id="wrapper-footer-full"> <div class="container-fluid" id="footer-full-content" tabindex="-1"> <div class="row"> <div id="text-4" class="footer-widget mb-3 widget_text widget-count-4 col-sm-6 col-lg-3"><h2 class="widget-title">About Us</h2> <div class="textwidget"><p>WordPress Fans website is a WordPress resource site for WordPress Users. The main goal of our website is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress users to improve their websites.</p> </div> </div><!-- .footer-widget --><div id="nav_menu-2" class="footer-widget mb-3 widget_nav_menu widget-count-4 col-sm-6 col-lg-3"><h2 class="widget-title">Site Links</h2><div class="menu-footer-links-menu-container"><ul id="menu-footer-links-menu" class="menu"><li id="menu-item-53" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-53"><a href="" data-wpel-link="internal">WordPress Plugins</a></li> <li id="menu-item-54" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-54"><a href="" data-wpel-link="internal">WordPress Guide</a></li> <li id="menu-item-55" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-55"><a href="" data-wpel-link="internal">WordPress Themes</a></li> <li id="menu-item-75" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-75"><a href="" data-wpel-link="internal">WordPress News</a></li> <li id="menu-item-111" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-111"><a href="" data-wpel-link="internal">Web Programming</a></li> <li id="menu-item-394" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-394"><a href="" data-wpel-link="internal">WordPress Template Tags</a></li> <li id="menu-item-85" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-85"><a href="" data-wpel-link="internal">Technology News</a></li> <li id="menu-item-58" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-58"><a href="" data-wpel-link="internal">Contact Us</a></li> </ul></div></div><!-- .footer-widget --><div id="nav_menu-3" class="footer-widget mb-3 widget_nav_menu widget-count-4 col-sm-6 col-lg-3"><h2 class="widget-title">FAQS</h2><div class="menu-help-menu-container"><ul id="menu-help-menu" class="menu"><li id="menu-item-59" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-59"><a href="" data-wpel-link="internal">How to build an online store with WordPress</a></li> <li id="menu-item-60" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-60"><a href="" data-wpel-link="internal">How to fix WordPress errors</a></li> <li id="menu-item-61" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-61"><a href="" data-wpel-link="internal">How to speed up your WordPress website</a></li> <li id="menu-item-62" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-62"><a href="" data-wpel-link="internal">How to start a blog with wordpress</a></li> <li id="menu-item-63" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-63"><a href="" data-wpel-link="internal">WordPress Security</a></li> <li id="menu-item-64" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-64"><a href="" data-wpel-link="internal">WordPress Seo</a></li> </ul></div></div><!-- .footer-widget --><div id="text-5" class="footer-widget mb-3 widget_text widget-count-4 col-sm-6 col-lg-3"><h2 class="widget-title">Follow Us</h2> <div class="textwidget"><p>Follow Us</p> </div> </div><!-- .footer-widget --> </div> </div> </div><!-- #wrapper-footer-full --> <div class="pt-3 pb-3 bg-primary" id="wrapper-footer"> <div class="container-fluid"> <div class="row"> <div class="col"> <footer class="site-footer" id="colophon"> <div class="site-info text-center small"> Copyright ©2021 <a href="" rel="home" data-wpel-link="internal">Wordpress Fans</a> : <a href="" data-wpel-link="internal">WordPress Skills, WordPress Themes, WordPress Plugins and everything about WordPress</a>. </div><!-- .site-info --> </footer><!-- #colophon --> </div><!--col end --> </div><!-- row end --> </div><!-- container end --> </div><!-- wrapper end --> </div><!-- #page we need this extra closing tag here --> <button onclick="simplenewsTopFunction()" id="simplenewsTopBtn" title="Scroll To Top" type="button" class="btn btn-primary btn-lg rounded-circle btn-fixed-btm" tabindex="-1"> <i class="fa fa-arrow-up" aria-hidden="true"></i> </button> <link rel='stylesheet' id='related-post-css' href='' type='text/css' media='all' /> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> </body> </html>