Forum Replies Created
Viewing 1 post (of 1 total)
-
AuthorPosts
-
Hannes_SParticipant
Thank you very much,
in doing is what I have tried to write a little complicated.I use the theme Bizlight Pro. Since I lacked a function in the blog, I have written for a plugin.
<?php add_action('the_content','dsgvo_ansichten'); add_filter( 'the_content', 'wpautop' , 99); function dsgvo_ansichten($content){ $MyType = get_post_type( get_the_ID() ); $customs = get_post_custom(get_the_ID()); if($MyType == 'dsgvo'){ $dsgvo_Content = ''; $derTitel = 'DS-GVO Artikel' ; //the_title; if (array_key_exists('_Nummer', $customs)) { $nummer = $customs['_Nummer'][0]; } else { $nummer=''; } $dsgvo_Content = '<h2>'.$derTitel.' '.$nummer.'</h2>'.$content; //Nummern von den ErwGründen auslesen if (array_key_exists('_ErwGrund', $customs)) { $_ErwGrund = $customs['_ErwGrund'][0]; } else { $_ErwGrund=''; } $myNumbers = ['relation' => 'OR']; // *** String zerlegen *** $teile = explode(",", $_ErwGrund); foreach($teile as $teil){ $einteil = explode("-", $teil); if(count($einteil)==2){ for ($i = $einteil[0]; $i <= $einteil[1]; $i++) { $myNumbers[] = ['key' => '_Nummer', 'value' => $i]; } } else { $myNumbers[] = ['key' => '_Nummer', 'value' => $teil]; } } // *** String zerlegt *** $args = array( 'post_type' => 'erwgrund', 'meta_query' => $myNumbers, 'orderby' => '_ErwGrund', 'order' => 'ASC', 'posts_per_page' => 40); $postslists = get_posts( $args ); $dsgvo_Content .= '<hr><h2>Die Erwägungsgründe</h2>'; if ( $postslists ) { foreach ( $postslists as $postslist ) { $dsgvo_Content .= '<h3>'.$postslist->post_title.'</h3>'.$postslist->post_content.'<br/><br />'; } } wp_reset_postdata(); return $dsgvo_Content; } if($MyType == 'erwgrund') { $nummer = $customs['_Nummer'][0]; $ErwGrund = $customs['_ErwGrund'][0]; $Sum = '<div><h2>Erwägungsgrund '.$nummer.'</h2><br />'.$content; $Sum .= '<br><hr><h2>gehört zur DS-GVO Artikel:'.$ErwGrund.'</h2></div>'; // Den Artikel dazu laden und dem String anhängen $args = array('post_type' => 'dsgvo', 'meta_query' => array(array('key' => '_Nummer', 'value' => $ErwGrund))); $postslists = get_posts( $args ); wp_reset_postdata(); if ( $postslists ) { foreach ( $postslists as $postslist ) { $Sum .= '<p>'.$postslist->post_content.'</p>'; } } return $Sum; } if($MyType <> 'erwgrund' AND $MyType <> 'dsgvo' ){ return $content; } } ?>
Unfortunately, now is not working the comments.
URL:
https://www.e-dsb.de/dsgvo/ds-gvo-artikel-1/Now I want to enable comments again.
Is that something intelligible? -
AuthorPosts
Viewing 1 post (of 1 total)