Major problem with post displaying
-
I’m working on a site of small local magazine and I have to create custom start page. Everything would be easier if the design was entirely mine, unfortunately it is a template bought by the owner of the site… I wrote two shortcodes functions and the shortcodes works fine.
functions:
function mainpage2($atts, $content = null) { $strr = do_shortcode($content); $tekst = '<div class="cat_title"><h2>' . $strr . '</h2><div class="clear"></div></div>'; return $tekst; } add_shortcode('nazwakategorii', 'mainpage2'); function mainpage1($atts, $content = null) { $rss = do_shortcode($content); $args = array( 'numberposts' => 1, 'category' => $rss ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); $eee = _e('Czytaj wi?cej', 'tfuse'); $tekst = '<div class="post-item"><h2><a href="' . the_permalink() . '">' . the_title() . '</a></h2><div class="post-meta"> <em>' . _e('przez', 'tfuse') . '<span class="author">' . the_author_posts_link() . '</span> | <a href="' . comments_link() . '" class="link-comments"> ' . comments_number('0 komentarzy', '1 komentarz', '2 komentarze', '3 komentarze', '4 komentarze', '% komenatarzy') . ' </a> </em> </div> <div class="entry">' . the_excerpt() .' <div class="clear"></div> </div> <a class="link-more" href="' . the_permalink() . '" > ' . $eee . ' </a> </div>'; endforeach; return $tekst; } add_shortcode('postglowna', 'mainpage1');
On my page I’ve got:
[nazwakategorii]Edytorial[/nazwakategorii] [postglowna]4[/postglowna]
Unfortunately I displays in completly wrong way. Take a look -> https://magazyn.linuxpl.info/
Thanks for your replays!
- The topic ‘Major problem with post displaying’ is closed to new replies.