problema con functions php

Inicio Foros WordPress Programación problema con functions php

Etiquetado: ,

Este debate contiene 0 respuestas, tiene 1 mensaje y lo actualizó  musicadeptos hace 8 años, 1 mes.

  • Autor
    Publicaciones
  • #18480

    musicadeptos
    Participante

    <p>Hola</p>
    <p>Al intentar introducir una nueva función en functions php y al ver que no funcionaba parece ser que he borrado algo que no debiera de tal forma que me da error al intentar actualizar los archivos y las entradas y al cerrar mi cuenta. El mensaje que me sale al intentar actualizar un archivo es el siguiente: Warning: Cannot modify header information – headers already sent by (output started at /usr/home/musicadeptos.com/web/wp-content/themes/news-magazine-theme-640/functions.php:937) in /usr/home/musicadeptos.com/web/wp-admin/theme-editor.php on line 89</p>
    <p>Copio el archivo functions php tal y como está ahora por si alguien localiza el problema:</p>
    <p>&lt;?php</p>
    <p>// Theme Vars</p>
    <p>$this_theme = "News Magazine Theme 640";<br />
    $themeoptionsprefix = "newsmag640";<br />
    $options = array();<br />
    $sidebarpos=array(‘1′,’2’);<br />
    $twops=array(‘1′,’2’);<br />
    $commentsonpage=array(‘yes’,’no’);<br />
    $arrnumposts=array(‘4′,’5′,’6′,’7′,’8′,’9′,’10’);<br />
    $numfeaturedarr=array(‘1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’10’);<br />
    $numfeaturedpostsarr=array(‘5′,’6′,’7′,’8′,’9′,’10’);<br />
    $showhidearr=array(‘show’,’hide’);<br />
    $deactivateslideshow=array(‘deactivate’,’activate’);<br />
    $sidebar2widgetspos=array(‘1′,’2’);<br />
    $textalignlc=array(‘left’,’center’);<br />
    $offonops=array(‘off’,’on’);<br />
    $onoffops=array(‘on’,’off’);<br />
    $singlepageadsensepositions=array(‘left’,’right’,’above post title’,’below post title’,’between post content and post details’,’under post details’);<br />
    $displayorder=array(‘DESC’,’ASC’);<br />
    $tierxpos=array(‘under tier one’,’under tier two’);<br />
    $showhideops=array(‘show’,’hide’);<br />
    $fulltextorexcerpt=array(‘fulltext’,’excerpt’);</p>
    <p>$thecatlist_A = get_categories(‘hide_empty=0’);<br />
    $catdlist = array();</p>
    <p>foreach ($thecatlist_A as $catforlist)<br />
    {</p>
    <p>$thecatname=$catforlist-&gt;cat_name;<br />
    $thecatname=str_replace("&amp;","&amp;",$thecatname);<br />
    $catdlist[$catforlist-&gt;cat_ID] = $thecatname;<br />
    }</p>
    <p>$categories_tmp = array_unshift($catdlist, "Select a category:");</p>
    <p>$pathtothemetemplate = get_bloginfo(‘template_directory’);</p>
    <p>$menuiconewsmag640=TEMPLATEPATH . ‘/images/newsmag640ico.png’;</p>
    <p>$sop=__("Select Option");<br />
    $selcat=__("Select Category");<br />
    $sel12=__("Select 1 or 2");<br />
    $o1=__("Turn On or Off the News Magazine Layout");<br />
    $o2=__("To activate or deactivate the news magazine layout select off or on");<br />
    $o3=__("Turn Off &lt;b&gt;About News Magazine Theme 640&lt;/b&gt;");<br />
    $o4=__("This option is here in case you decide not to use the news magazine layout. It turns off the about text and news magazine screenshot displayed above the posts on the index page.");<br />
    $o5=__("Show/Hide Add Post Link");<br />
    $o6=__("Selecting &lt;b&gt;show&lt;/b&gt; will display an &lt;b&gt;Add Post&lt;/b&gt; link in your homepage menu. Only you will be able to see the link");<br />
    $o7=__("Site Tracking Code Example: Google Analytics");<br />
    $o8=__("Using Goolge Analytics? You can enter your code above.");<br />
    $o9=__("Site Logo");<br />
    $o10=__("You can replace the text title with a logo by entering the logo URL here Note:include http://&quot;);<br />
    $o11=__("Show/Hide leaderboard Space");<br />
    $o12=__("Select &lt;b&gt;hide&lt;/b&gt; to hide or &lt;b&gt;show&lt;/b&gt; to display the leaderboard content space under the date/search bar");<br />
    $o13=__("Leaderboard Space Content");<br />
    $o14=__("Content for the leaderboard space under the date/search bar");<br />
    $o15=__("Leaderboard content text position");<br />
    $o16=__("Select left to align leaderboard content to left or center to align to center");<br />
    $o17=__("Tier 2 120");<br />
    $o18=__("Content for the 120 by 600 space in the third row on index page");<br />
    $o19=__("Show/Hide Tier 2 120");<br />
    $o20=__("Select &lt;b&gt;hide&lt;/b&gt; to hide or &lt;b&gt;show&lt;/b&gt; to display the 120 by 600 filler space in row 2");<br />
    $o21=__("Sidebar Position");<br />
    $o22=__("Select 1 to move narrow sidebar to left or 2 for right");<br />
    $o23=__("Featured Category #1");<br />
    $o24=__("Select your first featured category");<br />
    $o25=__("Featured Category #2");<br />
    $o26=__("Select your second featured category");<br />
    $o27=__("Featured Category #3");<br />
    $o28=__("Select your third featured category");<br />
    $o29=__("Featured Category #4");<br />
    $o30=__("Select your fourth featured category");<br />
    $o31=__("Featured Category #5");<br />
    $o32=__("Select your fifth featured category");<br />
    $o33=__("Hide Custom Sidebar elements");<br />
    $o34=__("The package comes with a custom recent topics and recent comments displayed in the sidebar. You can hide them if they are in the way of the placement of your widgets");<br />
    $o35=__("Position for sidebar 2 widgets");<br />
    $o36=__("If not hiding the custom recent topics and custom recent comments you can decide if to show your dragged widgets on top of the packaged sidebar elements or below them. Choose 1 for top or 2 for bottom");<br />
    $o37=__("Number of items for Custom Latest Topics");<br />
    $o38=__("If using the customized Latest Topics in sidebar select how many to display");<br />
    $o39=__("Number of items for Custom Recent Comments");<br />
    $o40=__("If using the customized Recent Comments in sidebar select how many to display");<br />
    $o41=__("Comment form on Post Pages");<br />
    $o42=__("Do you want posts of the type &lt;b&gt;Page&lt;/b&gt; to have a comment form?");<br />
    $o43=__("Ad code for single page posts");<br />
    $o44=__("If using positions left or right best to use 200 by 200 ads. For other positions best to use 468 by 60 ads");<br />
    $o45=__("Position for single page post ads");<br />
    $o46=__("Left will float left, right will float right – 6 position options");<br />
    $o47=__("State of default no image thumbnail");<br />
    $o48=__("If you prefer not to use a no image thumbnail for posts that have no image change state to off");<br />
    $o49=__("Display Order for custom latest comments");<br />
    $o50=__("You can change the order of the comments between DESC [last to first] and ASC [first to last] ");<br />
    $o51=__("Activate Extra content row");<br />
    $o52=__("If you need to feature another category select on to turn on the extra row available");<br />
    $o53=__("Extra content row position");<br />
    $o54=__("You can position the extra row under the first row or under the second row ");<br />
    $o55=__("Featured Category #6");<br />
    $o56=__("Select your sixth featured category(Note this category only shows up if you have turned on the extra content row");<br />
    $o57=__("Show/Hide RSS Subscribe block");<br />
    $o58=__("If you prefer not to show the block in the sidebar for RSS subscription hide it by selecting hide below");<br />
    $o59=__("Feedburner RSS URL");<br />
    $o60=__("Your Feedburner URL");<br />
    $o61=__("Feedburner ID");<br />
    $o62=__("Your Feedburner ID here");<br />
    $o63=__("Header for Sidebar Subscribe Block");<br />
    $o64=__("The text to display as the header above the subscribe links in the sidebar");<br />
    $o65=__("Subtext for rss subscribe block");<br />
    $o66=__("The text to display as a short description for why to subscribe to your feed");<br />
    $o67=__("Subscribe Link Text");<br />
    $o68=__("The text to use for your subscribe link");<br />
    $o69=__("Number of posts to show in featured category #6");<br />
    $o70=__("You might need to adjust the number of posts showin in featured category #6 to accommodate the side content in that row");<br />
    $o71=__("Thumbanail Function Switcher");<br />
    $o72=__("There are two functions for preparing thumbnails for display. If the default is not working for you try changing to the alternate.");<br />
    $o72a=__("Thumbanail File Switcher");<br />
    $o72b=__("If the thumbnails still don’t work regardless of which function you use try switching between cropper files.");<br />
    $o73=__("Language File");<br />
    $o74=__("Select on or off");<br />
    $o75=__("Blog Mode Full Text Or Excerpt");<br />
    $o76=__("If you are using the theme in blog mode (instead of magazine) you can display the content on the index page in full text mode or excerpt mode");<br />
    $o77=__("Blog Mode Excerpt Length");<br />
    $o78=__("If you are using the theme in blog mode (instead of magazine) and using excerpts instead of full text on index page you can control the excerpt length here");<br />
    $o79=__("Blog Mode Excerpt Thumbnail Width");<br />
    $o80=__("If you are using the theme in blog mode (instead of magazine) and using excerpts instead of full text on index page you can control the width of the thumbnails used in excerpts. **Only enter numerical value");<br />
    $o81=__("Blog Mode Show author/date byline under title");<br />
    $o82=__("If you are using the theme in blog mode (instead of magazine) use this option to display or conceal the author and date byline under the title");</p>
    <p>if(get_option($themeoptionsprefix.’_languagefileonoff’) == ‘on’){ load_theme_textdomain(NewsMagazineTheme640); }</p>
    <p>if ( function_exists(‘register_sidebar’) )<br />
    register_sidebars(1,array(<br />
    ‘name’=&gt;’IndexPageSidebar’,<br />
    ‘before_widget’ =&gt; ‘&lt;div class="widget"&gt;’,<br />
    ‘after_widget’ =&gt; ‘&lt;/div&gt;’,<br />
    ‘before_title’ =&gt; ‘&lt;h2&gt;’,<br />
    ‘after_title’ =&gt; ‘&lt;/h2&gt;’,<br />
    ));</p>
    <p> register_sidebars(1,array(<br />
    ‘name’=&gt;’SidebarNarrow’,<br />
    ‘before_widget’ =&gt; ‘&lt;div class="widget"&gt;’,<br />
    ‘after_widget’ =&gt; ‘&lt;/div&gt;’,<br />
    ‘before_title’ =&gt; ‘&lt;h2&gt;’,<br />
    ‘after_title’ =&gt; ‘&lt;/h2&gt;’,<br />
    ));</p>
    <p> register_sidebars(1,array(<br />
    ‘name’=&gt;’SidebarOther’,<br />
    ‘before_widget’ =&gt; ‘&lt;div class="widget"&gt;’,<br />
    ‘after_widget’ =&gt; ‘&lt;/div&gt;’,<br />
    ‘before_title’ =&gt; ‘&lt;h2&gt;’,<br />
    ‘after_title’ =&gt; ‘&lt;/h2&gt;’,<br />
    ));</p>
    <p> if(get_option($themeoptionsprefix.’_turnonofftierx’) != "off" )<br />
    {<br />
    register_sidebars(1,array(<br />
    ‘name’=&gt;’ExtraRowSidebar’,<br />
    ‘before_widget’ =&gt; ‘&lt;div class="widget"&gt;’,<br />
    ‘after_widget’ =&gt; ‘&lt;/div&gt;’,<br />
    ‘before_title’ =&gt; ‘&lt;h2&gt;’,<br />
    ‘after_title’ =&gt; ‘&lt;/h2&gt;’,<br />
    ));<br />
    }<br />
    elseif(get_option($themeoptionsprefix.’_turnonofftierx’) == ‘off’ )<br />
    {<br />
    unregister_sidebar( ‘ExtraRowSidebar’ );<br />
    }</p>
    <p>remove_action(‘wp_head’, ‘wp_generator’);</p>
    <p>function getImage ($post) {<br />
    $imageyn=false;</p>
    <p>$isimg= explode("&lt;img",$post);<br />
    if(sizeof($isimg) &gt; 1) {<br />
    $imageyn=true;}<br />
    return $imageyn;<br />
    }</p>
    <p>function teaserimg($mw=580,$mh=325)<br />
    {</p>
    <p>global $post;<br />
    $html = $post-&gt;post_content;<br />
    $output = preg_match_all(‘/&lt;img.+src=[‘"]([^’"]+)[‘"].*&gt;/i’, $html,<br />
    $matches, PREG_SET_ORDER);<br />
    $p = $matches [0] [1];<br />
    if(list($w,$h) = @getimagesize($p)) {<br />
    foreach(array(‘w’,’h’) as $v) { $m = "m{$v}";<br />
    if(${$v} &gt; ${$m} &amp;&amp; ${$m}) { $o = ($v == ‘w’) ? ‘h’ : ‘w’;<br />
    $r = ${$m} / ${$v}; ${$v} = ${$m}; ${$o} = ceil(${$o} * $r); } }<br />
    return $p; }<br />
    }</p>
    <p> function LimitText($Text,$Min,$Max,$MinAddChar) {<br />
    if (strlen($Text) &lt; $Min) {<br />
    $Limit = $Min-strlen($Text);<br />
    $Text .= $MinAddChar;<br />
    }<br />
    elseif (strlen($Text) &gt;= $Max) {<br />
    $words = explode(" ", $Text);<br />
    $check=1;<br />
    while (strlen($Text) &gt;= $Max) {<br />
    $c=count($words)-$check;<br />
    $Text=substr($Text,0,(strlen($words[$c])+1)*(-1));<br />
    $check++;<br />
    }<br />
    }</p>
    <p> return $Text;<br />
    }</p>
    <p>function get_the_post_image($thec) {<br />
    $images=array();</p>
    <p> if(stripos($thec, ‘&lt;img’)){</p>
    <p> $images = preg_match_all( "/<img />/im", $thec, $results );</p>
    <p> if( $images &gt; 0 )<br />
    {<br />
    foreach( $results as $value )<br />
    {<br />
    $image=$value[1];<br />
    }<br />
    }<br />
    else<br />
    {$image=”;}</p>
    <p> return $image;<br />
    }<br />
    }</p>
    <p>function some_posts_have_comments()<br />
    {</p>
    <p> global $wpdb;<br />
    $somepostshavecomments=false;</p>
    <p> $sql = "SELECT comment_ID FROM $wpdb-&gt;comments WHERE comment_approved = ‘1’";<br />
    $comments = $wpdb-&gt;get_results($sql);</p>
    <p> if(!empty($comments))<br />
    {<br />
    $somepostshavecomments=true;<br />
    }</p>
    <p> return $somepostshavecomments;</p>
    <p>}</p>
    <p>function have_posttype_posts_posts()<br />
    {</p>
    <p> global $wpdb;<br />
    $have_posttype_posts_posts=false;</p>
    <p> $sql = "SELECT ID FROM $wpdb-&gt;posts WHERE post_type=’post’ AND post_content &lt;&gt; ” AND post_title &lt;&gt; ” AND post_name &lt;&gt; ” AND post_password=” AND post_status=’publish’";<br />
    $postposts = $wpdb-&gt;get_results($sql);</p>
    <p> if(!empty($postposts))<br />
    {<br />
    $have_posttype_posts_posts=true;<br />
    }</p>
    <p> return $have_posttype_posts_posts;</p>
    <p>}</p>
    <p>function bdw_get_images($postID,$imgwidth,$imgheight,$thumborno)<br />
    {</p>
    <p> // Get the post ID<br />
    $iPostID = $postID;</p>
    <p> $files = get_children("post_parent=$iPostID&amp;post_type=attachment&amp;post_mime_type=image");<br />
    if($files)<br />
    {<br />
    $keys = array_keys($files);<br />
    $iNum=$keys[0];<br />
    }</p>
    <p> // Get the thumbnail url for the attachment<br />
    // $sThumbUrl = wp_get_attachment_thumb_url($iNum);</p>
    <p> if( (isset($thumborno)) &amp;&amp; ($thumborno == 1) )<br />
    {<br />
    $sThumbUrl = wp_get_attachment_thumb_url($iNum);<br />
    }<br />
    elseif( (isset($thumborno)) &amp;&amp; ($thumborno == 2) )<br />
    {<br />
    $sThumbUrl =wp_get_attachment_medium_url($iNum);<br />
    }<br />
    else<br />
    {<br />
    $sThumbUrl = wp_get_attachment_url($iNum);<br />
    }</p>
    <p> if(!isset($sThumbUrl) || empty($sThumbUrl))<br />
    {<br />
    $thepostimages = c12pulltheimgurl($iPostID);<br />
    foreach($thepostimages as $thepostimage)<br />
    {<br />
    $sThumbUrl=$thepostimages[0];<br />
    }</p>
    <p> }</p>
    <p> // UNCOMMENT THIS IF YOU WANT THE FULL SIZE IMAGE INSTEAD OF THE THUMBNAIL<br />
    //$sImageUrl = wp_get_attachment_url($iNum);</p>
    <p> // Build the <img /> string<br />
    if(isset($sThumbUrl) &amp;&amp; !empty($sThumbUrl))<br />
    {</p>
    <p> $sImgString = ‘<a href="’ . get_permalink() . ‘">’ .<br />
    ‘&lt;img src="’ . $sThumbUrl . ‘" width="’ . $imgwidth . ‘"’;<br />
    if(isset($imgheight) &amp;&amp; !empty($imgheight)){ $sImgString.=’height="’ . $imgheight . ‘"’; }<br />
    $sImgString.=’alt="’ . get_the_title($iPostID) . ‘" title="’ . get_the_title($iPostID) . ‘" border="0"/&gt;’ .<br />
    ‘</a>’;<br />
    }<br />
    else<br />
    {<br />
    $sImgString=”;<br />
    }</p>
    <p> // Print the image<br />
    echo $sImgString;</p>
    <p>}</p>
    <p>function get_image_for_crop($postID,$thumborno)<br />
    {</p>
    <p> // Get the post ID<br />
    $iPostID = $postID;<br />
    global $themeoptionsprefix;</p>
    <p> $files = get_children("post_parent=$iPostID&amp;post_type=attachment&amp;post_mime_type=image");<br />
    if($files){<br />
    $keys = array_keys($files);<br />
    $iNum=$keys[0];<br />
    }</p>
    <p> if( (isset($thumborno)) &amp;&amp; ($thumborno == 1) )<br />
    {<br />
    $sImageUrlSet = wp_get_attachment_thumb_url($iNum);<br />
    }<br />
    elseif( (isset($thumborno)) &amp;&amp; ($thumborno == 2) )<br />
    {<br />
    $sImageUrlSet =wp_get_attachment_medium_url($iNum);<br />
    }<br />
    else<br />
    {<br />
    $sImageUrlSet = wp_get_attachment_url($iNum);<br />
    }</p>
    <p> if(!isset($sImageUrlSet) || empty($sImageUrlSet))<br />
    {<br />
    $thepostimages = c12pulltheimgurl($iPostID);<br />
    foreach($thepostimages as $thepostimage)<br />
    {<br />
    $sImageUrlSet=$thepostimages[0];<br />
    }<br />
    }</p>
    <p> if(isset($sImageUrlSet) &amp;&amp; !empty($sImageUrlSet))<br />
    {<br />
    $sImageUrl = $sImageUrlSet;</p>
    <p> if(get_option($themeoptionsprefix.’_alternatecropper’) == ‘1’){<br />
    $sImageUrl=prepsimageurl($sImageUrl);<br />
    }<br />
    }<br />
    else<br />
    {<br />
    $sImageUrl=”;<br />
    }</p>
    <p> return $sImageUrl;</p>
    <p>}</p>
    <p>function c12pulltheimgurl($thepostid)<br />
    {<br />
    $theimgstring=get_the_content($thepostid);</p>
    <p> $c12tcmts = ‘/&lt;img (?:.*?)src=(?:"|’){1}(.*?)(?:"|’){1}/is’;</p>
    <p> $theimgmtchesarr = array();</p>
    <p> $procmatchs = preg_match_all($c12tcmts,$theimgstring,$theimgmtchesarr);</p>
    <p> if( $procmatchs!==false &amp;&amp; isset($theimgmtchesarr[1]) )<br />
    {<br />
    return $theimgmtchesarr[1];<br />
    }<br />
    else<br />
    {<br />
    return false;<br />
    }<br />
    }</p>
    <p>function wp_get_attachment_medium_url($id){<br />
    $medium_array = image_downsize( $id, ‘medium’ );<br />
    $medium_path = $medium_array[0];<br />
    return $medium_path;<br />
    }</p>
    <p>if(get_option($themeoptionsprefix.’_alternateprepsimageurl’) == ‘1’)<br />
    {</p>
    <p> function prepsimageurl($src) {</p>
    <p> // remove http/ https/ ftp<br />
    $src = preg_replace("/^((ht|f)tp(s|)://)/i", "", $src);<br />
    // remove domain name from the source url<br />
    $host = $_SERVER["HTTP_HOST"];<br />
    $src = str_replace($host, "", $src);<br />
    $host = str_replace("www.", "", $host);<br />
    $src = str_replace($host, "", $src);</p>
    <p> //$src = preg_replace( "/(?:^/+|.{2,}/+?)/", "", $src );<br />
    //$src = preg_replace( ‘/^w+://[^/]+/’, ”, $src );</p>
    <p> // don’t allow users the ability to use ‘../'<br />
    // in order to gain access to files below document root</p>
    <p> // src should be specified relative to document root like:<br />
    // src=images/img.jpg or src=/images/img.jpg<br />
    // not like:<br />
    // src=../images/img.jpg<br />
    $src = preg_replace( "/..+//", "", $src );</p>
    <p> return $src;</p>
    <p> }<br />
    }<br />
    elseif(get_option($themeoptionsprefix.’_alternateprepsimageurl’) == ‘2’)<br />
    {</p>
    <p> function prepsimageurl($src)<br />
    {<br />
    $url_parts = parse_url($src);<br />
    $theimgpath=$url_parts;<br />
    return $theimgpath;<br />
    }<br />
    }<br />
    else<br />
    {<br />
    function prepsimageurl($src)<br />
    {<br />
    $url_parts = parse_url($src);<br />
    $theimgpath=$url_parts;<br />
    return $theimgpath;<br />
    }<br />
    }</p>
    <p>// Handle Theme Options</p>
    <p>$options = array (</p>
    <p>array("optionname" =&gt; "General Settings",<br />
    "optiontype" =&gt; "heading"),</p>
    <p>array("optionname" =&gt; "$o1",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o2&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_newsmaglayon",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $offonops),</p>
    <p>array("optionname" =&gt; "$o3",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o4&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_turnoffindexabout",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $onoffops),</p>
    <p>array("optionname" =&gt; "$o75",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o76&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_fulltextorexcerpt",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $fulltextorexcerpt),</p>
    <p>array("optionname" =&gt; "$o77",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o78&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_fulltextorexcerptlength",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o81",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o82&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_showhideauthordatebyline",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $onoffops),</p>
    <p>array("optionname" =&gt; "$o79",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o80&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_fulltextorexcerptthumbwidth",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o5",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o6&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_hideaddpostlink",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $showhidearr),</p>
    <p>array("optionname" =&gt; "$o7",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o8&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_sitetrackingcode",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "textarea"),</p>
    <p>array("optionname" =&gt; "$o9",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o10&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_sitelogo",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o11",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o12&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_showhideleader",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $showhidearr),</p>
    <p>array("optionname" =&gt; "$o13",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o14&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_leadercode",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "textarea"),</p>
    <p>array("optionname" =&gt; "$o15",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o16&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_showhideleadercontentposition",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $textalignlc),</p>
    <p>array("optionname" =&gt; "$o17",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o18&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_filler120600",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "textarea"),</p>
    <p>array("optionname" =&gt; "$o19",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o20&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_filler120600hide",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $showhidearr),</p>
    <p>array("optionname" =&gt; "$o21",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o22&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_sidebarpos",<br />
    "selectoptiondef" =&gt; "$sop",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $sidebarpos),</p>
    <p>array("optionname" =&gt; "$o23",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o24&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat1",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o25",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o26&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat2",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o27",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o28&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat3",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o29",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o30&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat4",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o31",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o32&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat5",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o55",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o56&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_featuredcat6",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $catdlist),</p>
    <p>array("optionname" =&gt; "$o69",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o70&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_tierxshowhowmanyposts",<br />
    "selectoptiondef" =&gt; "$selcat:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $numfeaturedarr),</p>
    <p>array("optionname" =&gt; "$o33",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o34&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_hidecustomsidebarelements",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $showhidearr),</p>
    <p>array("optionname" =&gt; "$o35",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o36&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_sidebar2widgetspos",<br />
    "selectoptiondef" =&gt; "$sel12:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $sidebar2widgetspos),</p>
    <p>array("optionname" =&gt; "$o37",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o38&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_numlatesttopics",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $numfeaturedarr),</p>
    <p>array("optionname" =&gt; "$o39",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o40&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_numrecentcomments",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $numfeaturedarr),</p>
    <p>array("optionname" =&gt; "$o49",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o50&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_recentcommentsdisplayorder",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $displayorder),</p>
    <p>array("optionname" =&gt; "$o41",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o42&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_commentsonpage",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $commentsonpage),</p>
    <p>array("optionname" =&gt; "$o43",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o44&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_singlepageadsensecode",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "textarea"),</p>
    <p>array("optionname" =&gt; "$o45",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o46&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_singlepageadsenseposition",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $singlepageadsensepositions),</p>
    <p>array("optionname" =&gt; "$o47",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o48&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_noimagethumbnailstate",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $onoffops),</p>
    <p>array("optionname" =&gt; "$o71",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o72&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_alternateprepsimageurl",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $twops),</p>
    <p>array("optionname" =&gt; "$o72a",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o72b&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_alternatecropper",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $twops),</p>
    <p>array("optionname" =&gt; "$o51",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o52&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_turnonofftierx",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $offonops),</p>
    <p>array("optionname" =&gt; "$o53",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o54&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_tierxposition",<br />
    "selectoptiondef" =&gt; "$sop:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $tierxpos),</p>
    <p>array("optionname" =&gt; "$o57",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o58&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_rssblockshowhide",<br />
    "selectoptiondef" =&gt; "Select Option:",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $showhideops),</p>
    <p>array("optionname" =&gt; "$o59",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o60&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_feedburnerurl",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o61",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o62&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_feedburnerid",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o63",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o64&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_rsssubscribeblockh2",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o65",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o66&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_rsssubscribeblocksubtext",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o67",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o68&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_rsssubscribeblocklinktext",<br />
    "selectoptiondef" =&gt; "",<br />
    "optiontype" =&gt; "text"),</p>
    <p>array("optionname" =&gt; "$o73",<br />
    "optiondescription" =&gt; "&lt;p&gt;$o74&lt;/p&gt;",<br />
    "optionid" =&gt; $themeoptionsprefix."_languagefileonoff",<br />
    "optiontype" =&gt; "select",<br />
    "options" =&gt; $offonops),</p>
    <p>);</p>
    <p>function do_options_update_theme()<br />
    {<br />
    global $this_theme, $options;</p>
    <p> if ( $_GET == basename(__FILE__) )<br />
    {<br />
    if ( ‘updateoptions’ == $_REQUEST )<br />
    {</p>
    <p> foreach ($options as $optionvalue)<br />
    {<br />
    update_option( $optionvalue, $_REQUEST[ $optionvalue ] );<br />
    }</p>
    <p> foreach ($options as $optionvalue)<br />
    {</p>
    <p> if( isset( $_REQUEST[ $optionvalue ] ) )<br />
    {<br />
    update_option( $optionvalue, $_REQUEST[ $optionvalue ] );<br />
    }<br />
    else<br />
    {<br />
    delete_option( $optionvalue );<br />
    }</p>
    <p> }</p>
    <p> header("Location: admin.php?page=functions.php&amp;optionsupdated=true");</p>
    <p> die;</p>
    <p> }<br />
    }</p>
    <p> add_theme_page($this_theme." Options", $this_theme." Options", ‘edit_themes’, basename(__FILE__), ‘do_page_newsmag640’, $menuiconewsmag640);</p>
    <p>}</p>
    <p>function do_page_newsmag640 ()<br />
    {</p>
    <p> global $options, $this_theme;</p>
    <p>?&gt;</p>
    <p> &lt;div class="wrap"&gt;</p>
    <p> &lt;form action="&lt;?php echo $_SERVER; ?&gt;" method="post"&gt;</p>
    <p> &lt;h2&gt;&lt;?php echo $this_theme; ?&gt; Options&lt;/h2&gt;</p>
    <p> &lt;?php if ( $_REQUEST ) { ?&gt;&lt;?php echo "The options for $this_theme were saved"; } ?&gt;</p>
    <p> &lt;table&gt;</p>
    <p>&lt;?php</p>
    <p> foreach ($options as $optionvalue)<br />
    {</p>
    <p> if ( $optionvalue &lt;&gt; "heading" )<br />
    {</p>
    <p>?&gt;<br />
    &lt;tr&gt;<br />
    &lt;td valign="top" style="margin:0px 25px 30px 0px;background:#eeeeee;padding:10px;"&gt;&lt;?php echo $optionvalue; ?&gt;&lt;/td&gt;<br />
    &lt;td style="margin:0px 25px 30px 0px;background:#eeeeee;padding:10px;"&gt;<br />
    &lt;?php<br />
    }</p>
    <p> switch ( $optionvalue )<br />
    {<br />
    case ‘text’:</p>
    <p>?&gt;<br />
    &lt;input name="&lt;?php echo $optionvalue; ?&gt;" id="&lt;?php echo $optionvalue; ?&gt;" type="&lt;?php echo $optionvalue; ?&gt;" value="&lt;?php if ( get_settings( $optionvalue ) != "") { echo get_settings($optionvalue); } else { echo $optionvalue; } ?&gt;" /&gt;</p>
    <p>&lt;?php</p>
    <p> break;<br />
    case ‘select’:<br />
    ?&gt;<br />
    &lt;select name="&lt;?php echo $optionvalue; ?&gt;" id="&lt;?php echo $optionvalue; ?&gt;"&gt;<br />
    &lt;?php</p>
    <p> foreach ($optionvalue as $option)<br />
    {</p>
    <p>?&gt;<br />
    &lt;option&lt;?php if ( get_settings( $optionvalue ) == $option) { echo ‘ selected="selected"’; } elseif ($option == $optionvalue) { echo ‘ selected="selected"’; } ?&gt;&gt;&lt;?php echo $option; ?&gt;&lt;/option&gt;</p>
    <p>&lt;?php<br />
    }</p>
    <p>?&gt;<br />
    &lt;/select&gt;</p>
    <p>&lt;?php<br />
    break;<br />
    case ‘textarea’:<br />
    $textareainput = $optionvalue;</p>
    <p>?&gt;<br />
    &lt;textarea name="&lt;?php echo $optionvalue; ?&gt;" id="&lt;?php echo $optionvalue; ?&gt;" cols="100" rows="8"&gt;&lt;?php if( get_settings($optionvalue) != "") { echo stripslashes(get_settings($optionvalue)); } else { echo $optionvalue; } ?&gt;&lt;/textarea&gt;<br />
    &lt;?php</p>
    <p> break;<br />
    case "heading":</p>
    <p>?&gt;<br />
    &lt;/table&gt;<br />
    &lt;h3 class="title"&gt;&lt;?php echo $optionvalue; ?&gt;&lt;/h3&gt;<br />
    &lt;table&gt;</p>
    <p>&lt;?php</p>
    <p> break;<br />
    default:<br />
    break;</p>
    <p> }</p>
    <p>?&gt;</p>
    <p>&lt;?php</p>
    <p> if ( $optionvalue &lt;&gt; "heading" )<br />
    {</p>
    <p>?&gt;<br />
    &lt;span&gt;&lt;?php echo $optionvalue; ?&gt;&lt;/span&gt;<br />
    &lt;/td&gt;&lt;/tr&gt;</p>
    <p>&lt;?php</p>
    <p> }</p>
    <p>?&gt;</p>
    <p>&lt;?php</p>
    <p> }</p>
    <p>?&gt;</p>
    <p> &lt;/table&gt;</p>
    <p> &lt;p class="submit"&gt;<br />
    &lt;input name="updateoptions" type="submit" value="&lt;?php _e("Update Options",’NewsMagazineTheme640′);?&gt;" /&gt;<br />
    &lt;input type="hidden" name="action" value="updateoptions" /&gt;<br />
    &lt;/p&gt;&lt;/form&gt;<br />
    &lt;/div&gt;<br />
    &lt;?php</p>
    <p>}</p>
    <p>add_action(‘admin_menu’, ‘do_options_update_theme’);</p>
    <p>?&gt;
    </p>

El foro ‘Programación’ está cerrado y no se permiten nuevos debates ni respuestas.

Pin It on Pinterest