wp get post – kodowanie
-
Witam. Wgrałem wtyczkę get post(http://wordpress.org/extend/plugins/get-post/). Niestety w tytułach zamiast polskich znaków są krzaczki… Co dziwnego treść wyświetla normalnie.. proszę o pomoc.. z góry thx
kod wtyczki
<?php<br /> if (!class_exists('JamesGetPost'))<br /> {<br /> class JamesGetPost<br /> {<br /> function JamesGetPost()<br /> {<br /> }</p> <p> function get_post($tag='')<br /> {<br /> global $wp_query, $post, $id;<br /> $temp_query = clone $wp_query;<br /> $temp_post = clone $post;<br /> $temp_id = $id;<br /> $tag=htmlentities($tag);<br /> $myq = new WP_Query("tag=$tag&showposts=1");<br /> if ( $myq->have_posts() ) while ( $myq->have_posts() )<br /> {<br /> $myq->the_post();<br /> $pc='';<br /> $pc='<div class="post" id="post-'.$post->ID.'">';<br /> $pc.='<h2><a href="'.get_permalink().'" rel="bookmark">'.htmlentities($post->post_title).'</a></h2>';<br /> $pc.=$post->post_date;<br /> $pc.='<div class="entry">';<br /> $pc.=$post->post_content;<br /> $pc.='</div>';<br /> $pc.='</div>';<br /> }<br /> $wp_query = clone $temp_query;<br /> $post = clone $temp_post;<br /> $id = $temp_id;<br /> return $pc;<br /> }</p> <p> function read_params($params)<br /> {<br /> $re = '/tag="(?<tag>.+)"/';<br /> preg_match($re, $params, $matches);<br /> $tag = $matches['tag'];<br /> // Post content would be here<br /> return $this->get_post($tag);<br /> }<br /> function scan_content($content = '')<br /> {<br /> $re = '/(?<str>\[get\-post(?<params>.*)\])/';<br /> if (preg_match($re, $content, $matches))<br /> {<br /> $params = $matches['params'];<br /> $replace = $matches['str'];<br /> // Post content would be here<br /> $postcontent = $this->read_params($params);<br /> $content = str_replace($replace, $postcontent, $content);<br /> }<br /> return $content;<br /> }<br /> }</p> <p>}</p> <p>if (class_exists('JamesGetPost'))<br /> {<br /> $getpostplugin = new JamesGetPost();<br /> }</p> <p>if (isset($getpostplugin))<br /> {<br /> add_filter('the_content', array($getpostplugin, 'scan_content'));<br /> }</p> <p>?>
kodowanie strony utf-8
- Temat ‘wp get post – kodowanie’ jest zamknięty na nowe odpowiedzi.