{"id":26527,"date":"2013-01-03T15:56:56","date_gmt":"2013-01-03T15:56:56","guid":{"rendered":"https:\/\/br.wordpress.org\/support\/topic\/problema-no-functionsphp\/"},"modified":"2016-08-06T01:19:41","modified_gmt":"2016-08-06T01:19:41","slug":"problema-no-functionsphp","status":"closed","type":"topic","link":"https:\/\/br.wordpress.org\/support\/topic\/problema-no-functionsphp\/","title":{"rendered":"Problema no Functions.php"},"content":{"rendered":"<p>Ontem fui fazer uma modifica\u00e7\u00e3o no meu site, mas acabei colocando algo errado no functions.php. Aparece a seguinte mensagem quando abro o site: Parse error: syntax error, unexpected &#8216;:&#8217; in \/home\/dhenr137\/public_html\/wp-includes\/functions.php on line 114<br \/>\nSou nova nesse ramo e gostaria de saber se h\u00e1 algo de errado no c\u00f3digo:<\/p>\n<blockquote>\n<p>&lt;?php<\/p>\n<p>include &#8216;lib\/theme_options.php&#8217;;<br \/>\ninclude &#8216;lib\/guide.php&#8217;;<br \/>\ninclude &#8216;lib\/post-types.php&#8217;;<br \/>\ninclude &#8216;lib\/metabox.php&#8217;; <\/p>\n<p>\/* SIDEBARS *\/<br \/>\nif ( function_exists(&#8216;register_sidebar&#8217;) )<\/p>\n<p>\tregister_sidebar(array(<br \/>\n\t&#8216;name&#8217; =&gt; &#8216;Sidebar&#8217;,<br \/>\n    &#8216;before_widget&#8217; =&gt; &#8216;&lt;li class=&#8221;sidebox %2$s&#8221;&gt;&#8217;,<br \/>\n    &#8216;after_widget&#8217; =&gt; &#8221;,<br \/>\n\t&#8216;before_title&#8217; =&gt; &#8216;&lt;h3 class=&#8221;sidetitl &#8220;&gt;&#8217;,<br \/>\n    &#8216;after_title&#8217; =&gt; &#8216;&lt;\/h3&gt;&#8217;,<\/p>\n<p>    ));<\/p>\n<p>\tregister_sidebar(array(<br \/>\n\t&#8216;name&#8217; =&gt; &#8216;Footer&#8217;,<br \/>\n    &#8216;before_widget&#8217; =&gt; &#8216;&lt;li class=&#8221;botwid&#8221;&gt;&#8217;,<br \/>\n    &#8216;after_widget&#8217; =&gt; &#8221;,<br \/>\n\t&#8216;before_title&#8217; =&gt; &#8216;&lt;h3 class=&#8221;bothead&#8221;&gt;&#8217;,<br \/>\n    &#8216;after_title&#8217; =&gt; &#8216;&lt;\/h3&gt;&#8217;,<br \/>\n    ));\t\t<\/p>\n<p>\/* CUSTOM MENUS *\/\t<\/p>\n<p>register_nav_menus( array(<br \/>\n\t\t&#8216;primary&#8217; =&gt; __( &#8216;Primary Navigation&#8217;, &#8221; ),<br \/>\n\t) );<\/p>\n<p>function fallbackmenu(){ ?&gt;<br \/>\n\t\t\t&lt;div id=&#8221;submenu&#8221;&gt;<\/p>\n<ul>\n<li> Go to Adminpanel &gt; Appearance &gt; Menus to create your menu. You should have WP 3.0+ version for custom menus to work.<\/li>\n<\/ul>\n<p>\t\t\t&lt;\/div&gt;<br \/>\n&lt;?php }\t<\/p>\n<p>\/* ADD RECIPES TO RSS FEED *\/<\/p>\n<p>\/* CUSTOM EXCERPTS *\/<\/p>\n<p>function wpe_excerptlength_slide($length) {<br \/>\n    return 15;<br \/>\n}<br \/>\nfunction wpe_excerptlength_recipe($length) {<br \/>\n    return 35;<br \/>\n}<br \/>\nfunction wpe_excerptlength_index($length) {<br \/>\n    return 50;<br \/>\n}<\/p>\n<p>function wpe_excerpt($length_callback=&#8221;, $more_callback=&#8221;) {<br \/>\n    global $post;<br \/>\n    if(function_exists($length_callback)){<br \/>\n        add_filter(&#8216;excerpt_length&#8217;, $length_callback);<br \/>\n    }<br \/>\n    if(function_exists($more_callback)){<br \/>\n        add_filter(&#8216;excerpt_more&#8217;, $more_callback);<br \/>\n    }<br \/>\n    $output = get_the_excerpt();<br \/>\n    $output = apply_filters(&#8216;wptexturize&#8217;, $output);<br \/>\n    $output = apply_filters(&#8216;convert_chars&#8217;, $output);<br \/>\n    $output = &#8216;&lt;p&gt;&#8217;.$output.'&lt;\/p&gt;&#8217;;<br \/>\n    echo $output;<br \/>\n}<\/p>\n<p>function new_excerpt_more($more) {<br \/>\nreturn &#8216;<\/p>\n<p><a>ID) . &#8216;&#8221;&gt;&#8217; . &#8216;Leia Mais \u2192&#8217; . &#8216;&lt;\/br&gt;<\/a>&#8216;;<br \/>\n}<br \/>\nadd_filter(&#8216;excerpt_more&#8217;, &#8216;new_excerpt_more&#8217;);<\/p>\n<p>\/* SHORT TITLES *\/<\/p>\n<p>function short_title($after = &#8221;, $length) {<br \/>\n   $mytitle = explode(&#8216; &#8216;, get_the_title(), $length);<br \/>\n   if (count($mytitle)&gt;=$length) {<br \/>\n       array_pop($mytitle);<br \/>\n       $mytitle = implode(&#8221; &#8220;,$mytitle). $after;<br \/>\n   } else {<br \/>\n       $mytitle = implode(&#8221; &#8220;,$mytitle);<br \/>\n   }<br \/>\n       return $mytitle;<br \/>\n}<\/p>\n<p>\/* FEATURED THUMBNAILS *\/<\/p>\n<p>if ( function_exists( &#8216;add_theme_support&#8217; ) ) { \/\/ Added in 2.9<br \/>\n\tadd_theme_support( &#8216;post-thumbnails&#8217; );<\/p>\n<p>}<\/p>\n<p>\/* GET THUMBNAIL URL *\/<\/p>\n<p>function get_image_url(){<br \/>\n\t$image_id = get_post_thumbnail_id();<br \/>\n\t$image_url = wp_get_attachment_image_src($image_id,&#8217;large&#8217;);<br \/>\n\t$image_url = $image_url[0];<br \/>\n\techo $image_url;<br \/>\n\t}<\/p>\n<p>\/* PAGE NAVIGATION *\/<\/p>\n<p>\tpadding:0px 5px 0px 5px;<br \/>\n\tmargin: 5px 3px 5px 3px;<br \/>\n\tfont-weight:normal;<br \/>\n\tbackground: #CCCCCD;<\/p>\n<p>function getpagenavi(){<br \/>\n?&gt;<br \/>\n&lt;div id=&#8221;navigation&#8221;&gt;<br \/>\n&lt;?php if(function_exists(&#8216;wp_pagenavi&#8217;)) : ?&gt;<br \/>\n&lt;?php wp_pagenavi() ?&gt;<br \/>\n&lt;?php else : ?&gt;<br \/>\n        &lt;div class=&#8221;alignleft&#8221;&gt;&lt;?php next_posts_link(__(&#8216;&laquo; Posts Antigos&#8217;,&#8217;arclite&#8217;)) ?&gt;&lt;\/div&gt;<br \/>\n        &lt;div class=&#8221;alignright&#8221;&gt;&lt;?php previous_posts_link(__(&#8216;Posts Novos &raquo;&#8217;,&#8217;arclite&#8217;)) ?&gt;&lt;\/div&gt;<br \/>\n        &lt;div class=&#8221;clear&#8221;&gt;&lt;\/div&gt;<br \/>\n&lt;?php endif; ?&gt;<\/p>\n<p>&lt;\/div&gt;<\/p>\n<p>&lt;?php<br \/>\n}<\/p>\n<p>function mytheme_add_init() {<br \/>\n$file_dir=get_bloginfo(&#8216;template_directory&#8217;);<br \/>\nwp_enqueue_style(&#8220;mce&#8221;, $file_dir.&#8221;\/lib\/mce.css&#8221;, false, &#8220;1.0&#8221;, &#8220;all&#8221;);<br \/>\n}<br \/>\nadd_action(&#8216;admin_init&#8217;, &#8216;mytheme_add_init&#8217;);<\/p>\n<p>\/* Adding a Taxonomy Filter to Admin List for a Custom Post Type*\/<\/p>\n<p>add_action( &#8216;restrict_manage_posts&#8217;, &#8216;my_restrict_manage_posts&#8217; );<br \/>\nfunction my_restrict_manage_posts() {<\/p>\n<p>    \/\/ only display these taxonomy filters on desired custom post_type listings<br \/>\n    global $typenow;<br \/>\n    if ($typenow == &#8216;recipes&#8217;) {<\/p>\n<p>        \/\/ create an array of taxonomy slugs you want to filter by &#8211; if you want to retrieve all taxonomies, could use get_taxonomies() to build the list<br \/>\n        $filters = array(&#8216;cuisine&#8217;, &#8216;meal&#8217;,&#8217;food&#8217;);<\/p>\n<p>        foreach ($filters as $tax_slug) {<br \/>\n            \/\/ retrieve the taxonomy object<br \/>\n            $tax_obj = get_taxonomy($tax_slug);<br \/>\n            $tax_name = $tax_obj-&gt;labels-&gt;name;<\/p>\n<p>            \/\/ output html for taxonomy dropdown filter<br \/>\n            echo &#8220;&lt;select name=&#8217;$tax_slug&#8217; id=&#8217;$tax_slug&#8217; class=&#8217;postform&#8217;&gt;&#8221;;<br \/>\n            echo &#8220;&lt;option value=&#8221;&gt;Show All $tax_name&lt;\/option&gt;&#8221;;<br \/>\n            generate_taxonomy_options($tax_slug,0,0);<br \/>\n            echo &#8220;&lt;\/select&gt;&#8221;;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>function generate_taxonomy_options($tax_slug, $parent = &#8221;, $level = 0) {<br \/>\n    $args = array(&#8216;show_empty&#8217; =&gt; 1);<br \/>\n    if(!is_null($parent)) {<br \/>\n        $args = array(&#8216;parent&#8217; =&gt; $parent);<br \/>\n    }<br \/>\n    $terms = get_terms($tax_slug,$args);<br \/>\n    $tab=&#8221;;<br \/>\n    for($i=0;$i&lt;$level;$i++){<br \/>\n        $tab.=&#8217;&#8211;&#8216;;<br \/>\n    }<br \/>\n    foreach ($terms as $term) {<br \/>\n        \/\/ output each select option line, check against the last $_GET to show the current option selected<br \/>\n        echo &#8216;&lt;option value=&#8217;. $term-&gt;slug, $_GET[$tax_slug] == $term-&gt;slug ? &#8216; selected=&#8221;selected&#8221;&#8216; : &#8221;,&#8217;&gt;&#8217; .$tab. $term-&gt;name .&#8217; (&#8216; . $term-&gt;count .&#8217;)&lt;\/option&gt;&#8217;;<br \/>\n        generate_taxonomy_options($tax_slug, $term-&gt;term_id, $level+1);<br \/>\n    }<\/p>\n<p>}<\/p>\n<p>?&gt;<\/p>\n<\/blockquote>\n","protected":false},"template":"","class_list":["post-26527","topic","type-topic","status-closed","hentry","topic-tag-function","topic-tag-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/26527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/26527\/revisions"}],"wp:attachment":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=26527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}