Sign in QQ login WeChat login
All categories

How does Z-blogPHP implement custom article title colors?

finchui seven hundred and four 2023-07-06 17:55:10

The following provides a way to filter The plug-in modifies the color of the article title.

1. Add extension function in article editing.

 Echo '<div class="editmod"><label style="color:'. htmlspecialcars ($article ->Methods ->titlecolor, ENT_COMPAT, 'ISO-8859-1'). ';" class="editinputname">title color</label>';     echo '<input type="text" style="width:100px; font-weight: bold; color:' .  htmlspecialchars($article->Metas->titlecolor, ENT_COMPAT, 'ISO-8859-1') .  '; " name="meta_titlecolor" class="input" value="' .  htmlspecialchars($article->Metas->titlecolor, ENT_COMPAT, 'ISO-8859-1') .  '"/></div>';

2. Add filters and wrapper functions in the include.php file

 image.png

     function ActivePlugin_fullpage() { //Here are the filter codes     Add_Filter_Plugin('Filter_Plugin_ViewPost_Template', 'fullpage_ViewPost_article_titlecolor');     Add_Filter_Plugin('Filter_Plugin_ViewList_Template', 'fullpage_ViewList_article_titlecolor');     Add_Filter_Plugin('Filter_Plugin_ViewSearch_Template','fullpage_ViewSearch_article_titlecolor');     }      //Article Title Color function fullpage_ViewPost_article_titlecolor(&$template) {     // global $zbp;     $article = $template->GetTags('article');     if ($article->Metas->titlecolor) {         $article->Title =  "<em style='color:" .  $article->Metas->titlecolor .  "'>" .  $article->Title .  "</em>";     }     $template->SetTags('article', $article); } //Home and list page article title color function fullpage_ViewList_article_titlecolor($template) {     // global $zbp;     $articles = $template->GetTags('articles');     foreach ($articles as $article) {         if ($article->Metas->titlecolor) {             $article->Title = "<em style='color:" .  $article->Metas->titlecolor .  "'>" .  $article->Title .  "</em>";         }     } } //Search Page Article Title Color function fullpage_ViewSearch_article_titlecolor($template) {     // global $zbp;     $articles = $template->GetTags('articles');     foreach ($articles as $article) {         if ($article->Metas->titlecolor) {             $article->Title = "<em style='color:" .  $article->Metas->titlecolor .  "'>" .  $article->Title .  "</em>";         }     } }


3. Set the article title color in the article editor to take effect in the corresponding article title.

  • Dislike( one

Link to this article: https://www.finchui.com/zblog-course/54.html

Netizen comments

Hot commodity
Popular articles
Hot tags
Related labels
 FinchUI Store Edition

share

Copy Link

Xinglan Studio Online consultation

Working hours: 9:00-22:00
Saturday and Sunday: 14:00-22:00