{"id":6346,"date":"2020-03-15T03:11:22","date_gmt":"2020-03-15T03:11:22","guid":{"rendered":"https:\/\/ro.wordpress.org\/support\/topic\/problema-cu-atributul-alt-la-imagini\/"},"modified":"2020-03-15T03:11:22","modified_gmt":"2020-03-15T03:11:22","slug":"problema-cu-atributul-alt-la-imagini","status":"publish","type":"topic","link":"https:\/\/ro.wordpress.org\/support\/topic\/problema-cu-atributul-alt-la-imagini\/","title":{"rendered":"Problema cu atributul alt la imagini"},"content":{"rendered":"<p>Buna<br \/>\nAm o problema cu o thema wp  imi lipseste atributul alt.<br \/>\nSi am ceva neinchis in cod.<br \/>\nVoi atasa codul unde trebuie implementat alt si inchis ce e deschis.<\/p>\n<pre><code>&lt;?php\nadd_action( &#039;widgets_init&#039;, &#039;themeloy_rec_register_widgets&#039; );\n\nfunction themeloy_rec_register_widgets() {\n\tregister_widget( &#039;themeloy_rec_posts_widget&#039; );\n}\n\nclass themeloy_rec_posts_widget extends WP_Widget {\n\n\t\t\t\n\tfunction __construct() {\n    \t$widget_ops = array(\n\t\t\t&#039;classname&#039;   =&gt; &#039;post_list_widget&#039;, \n\t\t\t&#039;description&#039; =&gt; __(&#039;Display a list of recent post entries from choosing categories.&#039;, &#039;tl_back&#039;)\n\t\t);\n    \tparent::__construct(&#039;rec-recent-posts&#039;, __(&#039;Themeloy: Recently Posts&#039;, &#039;tl_back&#039;), $widget_ops);\n\t}\n\n\tfunction widget($args, $instance) {\n        extract($args);\n        $title = apply_filters(&#039;widget_title&#039;, empty($instance[&#039;title&#039;]) ? &#039;Recently Articles&#039; : $instance[&#039;title&#039;], $instance, $this-&gt;id_base);\n        if (!$number = absint($instance[&#039;number&#039;]))\n            $number = 6;\n        if (!$cats = $instance[&quot;cats&quot;])\n            $cats = &#039;&#039;;\n\n        $post_cat_args = array(\n            &#039;showposts&#039; =&gt; $number,\n            &#039;category__in&#039; =&gt; $cats,\n        );\n\n        $post_cat_widget = null;\n        $post_cat_widget = new WP_Query($post_cat_args);\n\n        echo $before_widget;\n\n        echo $before_title;\n        echo $instance[&quot;title&quot;];\n        echo $after_title;\n\n        \/\/ Post list in widget\n\t\techo &#039;&lt;div class=&quot;widget_container&quot;&gt;&#039;;\n        echo &#039;&lt;ul class=&quot;post_list&quot;&gt;&#039;;\n\n        while ($post_cat_widget-&gt;have_posts()) {\n            $post_cat_widget-&gt;the_post();\n\t\t\t$post_id = get_the_ID();\n            ?&gt;\n           &lt;li class=&quot;clearfix&quot;&gt;\t\n                &lt;div class=&quot;img_thumbnail feature-item&quot;&gt;\n\t\t\t\t&lt;?php\t\t\t\t\n                echo &#039;&lt;a class=&quot;img_thumbnail&quot; href=&quot;&#039; . get_permalink() . &#039;&quot; title=&quot;&#039; . the_title_attribute(&#039;echo=0&#039;) . &#039;&quot;&gt;&#039;;?&gt;\n&lt;?php if ( has_post_thumbnail()) {\n\t$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), &#039;small-feature&#039; );?&gt;\n        &lt;img src=&quot;&lt;?php echo $image[0]; ?&gt;&quot; \/&gt;\n&lt;?php }else{echo &#039;&lt;img src=&quot;&#039;.get_template_directory_uri().&#039;\/images\/demo\/small-feature.jpg&#039;.&#039;&quot;&gt;&#039;;} ?&gt;\t\n\t\t\t\t\n              &lt;\/a&gt;\n              &lt;?php echo themeloy_post_type(); ?&gt;\n         &lt;\/div&gt;\n                &lt;div class=&quot;list_desc&quot;&gt;\n                     &lt;h4 class=&quot;list_title&quot;&gt;&lt;a class=&quot;post-title&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;&lt;?php the_title_attribute(); ?&gt;&quot;&gt;\n\t\t\t\t\t&lt;?php the_title(); ?&gt;\n\t\t\t\t\t&lt;\/a&gt;&lt;\/h4&gt;\n                   &lt;?php echo themeloy_post_meta(get_the_ID());?&gt;\n\t\t\t\t\t\t\t&lt;?php \n\t\t\t\t\t\t\t    $post_review = get_post_custom_values(&#039;enable_review_themeloy_select&#039;, $post_id); \n\t\t\t\t\t\t\t\t$post_review = ($post_review[0] != &#039;&#039;) ? $post_review[0] : of_get_option(&#039;enable_all_review&#039;);\n\t\t\t\t\t\t\t\t$total_review = absint(themeloy_get_total_review($post_id));\n\t\t\t\t\t\t\t    if($post_review == &#039;1&#039;){\n\t\t\t\t\t\t\t   ?&gt;\n&lt;div class=&quot;ratings&quot;&gt;\n&lt;div class=&quot;rating-box&quot;&gt;\n&lt;div class=&quot;rating&quot; style=&quot;width:&lt;?php echo themeloy_get_total_review(get_the_ID()); ?&gt;%&quot;&gt;&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;\/div&gt;\n &lt;?php }?&gt; \n                \n                &lt;\/div&gt;\n\n            &lt;\/li&gt;\n            &lt;?php\n        }\n\n        wp_reset_query();\n\n        echo &quot;&lt;\/ul&gt;\\n&quot;;\n\t\techo &quot;&lt;\/div&gt;\\n&quot;;\n        echo $after_widget;\n    }\n\n\t\n\tfunction update( $new_instance, $old_instance ) {\n\t\t$instance = $old_instance;\n\t\t$instance[&#039;title&#039;] = strip_tags($new_instance[&#039;title&#039;]);\n        $instance[&#039;cats&#039;] = $new_instance[&#039;cats&#039;];\n\t\t$instance[&#039;number&#039;] = absint($new_instance[&#039;number&#039;]);\n\t\t \n        return $instance;\n\t}\n\n\t\n\tfunction form( $instance ) {\n\t\t$title = isset($instance[&#039;title&#039;]) ? esc_attr($instance[&#039;title&#039;]) : &#039;Recent Posts&#039;;\n\t\t$number = isset($instance[&#039;number&#039;]) ? absint($instance[&#039;number&#039;]) : 5;\n\t\t\n?&gt;\n        &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;title&#039;); ?&gt;&quot;&gt;&lt;?php _e(&#039;Title:&#039;, &#039;tl_back&#039;); ?&gt;&lt;\/label&gt;\n        &lt;input class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;title&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;title&#039;); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; \/&gt;&lt;\/p&gt;\n                        \n        &lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;number&#039;); ?&gt;&quot;&gt;&lt;?php _e(&#039;Number of posts to show:&#039;, &#039;tl_back&#039;); ?&gt;&lt;\/label&gt;\n        &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;number&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;number&#039;); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $number; ?&gt;&quot; size=&quot;3&quot; \/&gt;&lt;\/p&gt;\n        \n         &lt;p&gt;\n            &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;cats&#039;); ?&gt;&quot;&gt;&lt;?php _e(&#039;Select categories to include in the recent posts list:&#039;, &#039;tl_back&#039;);?&gt; \n            \n                &lt;?php\n                   $categories=  get_categories(&#039;hide_empty=0&#039;);\n                     echo &quot;&lt;br\/&gt;&quot;;\n                     foreach ($categories as $cat) {\n                    $option = &#039;&lt;input type=&quot;checkbox&quot; id=&quot;&#039; . $this-&gt;get_field_id(&#039;cats&#039;) . &#039;[]&quot; name=&quot;&#039; . $this-&gt;get_field_name(&#039;cats&#039;) . &#039;[]&quot;&#039;;\n              \n\t\t\t        if (isset($instance[&#039;cats&#039;])) {\n                        foreach ($instance[&#039;cats&#039;] as $cats) {\n                            if ($cats == $cat-&gt;term_id) {\n                                $option = $option . &#039; checked=&quot;checked&quot;&#039;;\n                            }\n                        }\n                    }\n\t\t\t  \n                    $option .= &#039; value=&quot;&#039; . $cat-&gt;term_id . &#039;&quot; \/&gt;&#039;;\n                    $option .= &#039;&amp;nbsp;&#039;;\n                    $option .= $cat-&gt;cat_name;\n                    $option .= &#039;&lt;br \/&gt;&#039;;\n                    echo $option;\n                }\n                    \n                    ?&gt;\n            &lt;\/label&gt;\n        &lt;\/p&gt;\n        \n&lt;?php\n\t}\n}\n?&gt;\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-6346","topic","type-topic","status-publish","hentry","topic-tag-alt-imag","topic-tag-eror-alt"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ro.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ro.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ro.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ro.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6346\/revisions"}],"wp:attachment":[{"href":"https:\/\/ro.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}