{"id":58172,"date":"2016-04-23T10:54:18","date_gmt":"2016-04-23T09:54:18","guid":{"rendered":"https:\/\/pl.wordpress.org\/support\/topic\/problem-z-posts-sliderem-w-evolve\/"},"modified":"2016-08-05T22:17:13","modified_gmt":"2016-08-05T22:17:13","slug":"problem-z-posts-sliderem-w-evolve","status":"publish","type":"topic","link":"https:\/\/pl.wordpress.org\/support\/topic\/problem-z-posts-sliderem-w-evolve\/","title":{"rendered":"Problem z posts sliderem w evolve"},"content":{"rendered":"<p>Witam,<br \/>\nu\u017cywam evolve lite 3.3.0. Mam problem z posts sliderem na g\u0142\u00f3wnej stronie.<br \/>\nWy\u015bwietla on ostatnie posty z okre\u015blonych przeze mnie kategorii. Na slidach s\u0105 dwa linki. Pierwszy &#8211; w tytule &#8211; dzia\u0142a poprawnie i odsy\u0142a do ca\u0142o\u015bci w\u0142a\u015bciwego postu. Drugi, w przycisku Read more, odsy\u0142a do ostatnio opublikowanego postu z jednej z kategorii, kt\u00f3re zosta\u0142y pod\u0142\u0105czone do slidera. Wygl\u0105da to tak, \u017ce linki w tytu\u0142ach s\u0105 ok na wszystkich pi\u0119ciu czy sze\u015bciu slajdach, a linki w &#8222;Read more&#8221; odsy\u0142aj\u0105 na wszystkich slajdach do postu z pierwszego slajdu.<\/p>\n<p>Poni\u017cej fragment kodu z basic functions.php, dotycz\u0105cy posts slidera.<br \/>\nKto\u015b? Co\u015b? M\u00f3g\u0142by? Macie jakie\u015b pomys\u0142y?<\/p>\n<blockquote>\n<p>\nfunction evolve_posts_slider() {<br \/>\n?&gt;<br \/>\n\t&lt;div id=&#8221;slide_holder&#8221;&gt;<br \/>\n\t\t&lt;div class=&#8221;slide-container&#8221;&gt;<\/p>\n<p>\t\t\t&lt;ul id=&#8221;slides&#8221;&gt;<\/p>\n<p>\t\t\t\t&lt;?php<br \/>\n\t\t\t\t$number_items = evolve_get_option(&#8217;evl_posts_number&#8217;,&#8217;5&#8242;);<br \/>\n\t\t\t\t$slider_content = evolve_get_option(&#8217;evl_posts_slider_content&#8217;,&#8217;recent&#8217;);<br \/>\n\t\t\t\t$slider_content_category = &#8221;;<br \/>\n\t\t\t\t$slider_content_category = evolve_get_option(&#8217;evl_posts_slider_id&#8217;,&#8221;);<\/p>\n<p>\t\t\t\tif ($slider_content == &#8222;category&#8221; &amp;&amp; !empty($slider_content_category) ) {<br \/>\n\t\t\t\t$slider_content_ID = $slider_content_category;<br \/>\n\t\t\t\t} else {<br \/>\n\t\t\t\t$slider_content_ID = &#8221;;<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t\t$args = array(<br \/>\n\t\t\t\t    'cat&#8217;=&gt; $slider_content_ID,<br \/>\n\t\t\t\t    'showposts&#8217;=&gt; $number_items,<br \/>\n\t\t\t\t    'ignore_sticky_posts&#8217; =&gt;1,<br \/>\n\t\t\t\t);<br \/>\n\t\t\t\tquery_posts($args);<\/p>\n<p>\t\t\t\tif (have_posts()) : $featured = new WP_Query($args); while($featured-&gt;have_posts()) : $featured-&gt;the_post();<br \/>\n\t\t\t\t?&gt;<\/p>\n<p>\t\t\t\t&lt;li class=&#8221;slide&#8221;&gt;<\/p>\n<p>\t\t\t\t\t&lt;?php<br \/>\n\t\t\t\t\t\tif(has_post_thumbnail()) {<br \/>\n\t\t\t\t\t\t\techo '&lt;div class=&#8221;featured-thumbnail&#8221;&gt;<a href=\"'; the_permalink(); echo '\">&#8217;;the_post_thumbnail(&#8217;slider-thumbnail&#8217;); echo &#8217;<\/a>&lt;\/div&gt;&#8217;;<br \/>\n\t\t\t\t\t     }else{<br \/>\n\t\t\t\t\t     \t$image = evolve_get_first_image();<br \/>\n\t\t\t\t\t     \tif ($image):<br \/>\n\t\t\t\t\t        \techo '&lt;div class=&#8221;featured-thumbnail&#8221;&gt;<a href=\"'; the_permalink(); echo'\">&lt;img src=&#8221;&#8217;.$image.'&#8221; alt=&#8221;&#8217;;the_title();echo'&#8221; \/&gt;<\/a>&lt;\/div&gt;&#8217;;<br \/>\n\t\t\t\t\t        endif;<br \/>\n\t\t\t\t\t     }<br \/>\n\t\t\t\t\t?&gt; <\/p>\n<p>\t\t\t\t\t&lt;h2 class=&#8221;featured-title&#8221;&gt;<br \/>\n\t\t\t\t\t\t<a>&#8222;&gt;<br \/>\n\t\t\t\t\t\t&lt;?php<br \/>\n\t\t\t\t\t\t$title = the_title(&#8221;, &#8221;, false);<br \/>\n\t\t\t\t\t\t$length = evolve_get_option(&#8217;evl_posts_slider_title_length&#8217;,40);<br \/>\n\t\t\t\t\t\techo evolve_truncate($title, $length, '&#8230;&#8217;);<br \/>\n\t\t\t\t\t\t?&gt;<br \/>\n\t\t\t\t\t\t<\/a><br \/>\n\t\t\t\t\t&lt;\/h2&gt; <\/p>\n<p>\t\t\t\t\t&lt;p&gt;&lt;?php echo evolve_excerpt_max_charlength(180); ?&gt;&lt;\/p&gt;<br \/>\n\t\t\t\t\t<a>&#8222;&gt;&lt;?php _e( 'Czytaj dalej&#8217;, 'evolve&#8217; ); ?&gt;<\/a>    <\/p>\n<p>\t\t\t\t&lt;?php endwhile; ?&gt; <\/p>\n<p>\t\t\t\t&lt;?php else: ?&gt;  <\/p>\n<li>&lt;?php _e( '&lt;h2 style=&#8221;color:#fff;&#8221;&gt;Oops, no posts to display! Please check your post slider Category (ID) settings&lt;\/h2&gt;&#8217;, 'evolve&#8217; ); ?&gt;<\/li>\n<p>\t\t\t\t&lt;?php endif; ?&gt;<br \/>\n\t\t\t\t&lt;?php wp_reset_query(); ?&gt;<\/p>\n<p>\t\t&lt;\/div&gt;<br \/>\n\t&lt;\/div&gt;<br \/>\n&lt;?php<br \/>\n}\n<\/p>\n<\/blockquote>\n","protected":false},"template":"","class_list":["post-58172","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/58172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/58172\/revisions"}],"wp:attachment":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=58172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}