WordPress

Allgemein

Technik

Design

Konzept

WordPress Plugins

Interessantes

Vermarktung

Themen

Font / Schriften

Social Media

Youtube

eCommerce

Gemischtes

Kolumne

Webinar

Blog Archiv

Kurse / Webinare

Meine nächste Webinare / Kurse

DIVI: Wie binde ich Schlagwörter / Tags in das Divi Blog Modul ein?

von | Jan 10, 2024 | Allgemein | 0 Kommentare

Schlagwörter: DIVI

Vor gut einem Jahr habe ich euch bereits gezeigt wie ihr Schlagwörter / Tags in die Blogbeiträge einbinden könnt (DIVI: Wie binde ich Schlagwörter / Tags in Blogbeiträge ein?). Und heute zeige ich euch wie man diese Schlagwörter / Tags direkt in das Divi Blogmodul einbinden könnt. Und ja es ist egal ob ihr das Modul als Grid eingebaut habt oder im Full-Width Design – die Tags und Schlagwörter werden immer angezeigt.

Video

Functions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* add tag to blog module */
 
function cb_add_blog_module_article_filter($content) {
    if (is_array($content)) { return $content; }
    return preg_replace_callback('/<article.*?<\/article>/s', 'cb_apply_blog_module_article_filter', $content);
}
add_filter('et_pb_blog_shortcode_output', 'cb_add_blog_module_article_filter');
 
function cb_apply_blog_module_article_filter($match) {
    if (!is_array($match) || !isset($match[0])) { return $match; }
    return apply_filters('blog_module_article', $match[0]);
}
add_filter('blog_module_article', 'cb_blog_module_add_tags');
 
 
function cb_blog_module_add_tags($html) {
    $match = false;
    preg_match('/<article id="post-(\d*)"/', $html, $match);
    $id = isset($match[1])?intval($match[1]):false;
    if (!$id) { return $html; }
    $tags = get_the_tag_list('', ', ', '', $id);
    if (empty($tags)) { return $html; }
    if (strpos($html, '<p class="post-meta">') !== false) {
        $html = preg_replace('/(<p class="post-meta">.*?)(<\/p>)/s', '\\1 | '.$tags.'\\2', $html);
    } else {
        $html = preg_replace('/(<div class="post-content">)/s', '<p class="post-meta">'.$tags.'</p>\\1', $html);
    }
    return $html;
}




0 Kommentare

Einen Kommentar abschicken

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert