Ver Mensaje Individual
  #14 (permalink)  
Antiguo 22/02/2011, 06:38
Xijamk
 
Fecha de Ingreso: febrero-2011
Mensajes: 16
Antigüedad: 13 años, 10 meses
Puntos: 1
Respuesta: [Problema] Eliminar enlace permanente de la página

functions.php :
Código:
<?php

$art_config = parse_ini_file(TEMPLATEPATH."/config.ini", true);

$options = array (
                array(  "name" =>   "HTML",
                        "desc" =>   sprintf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>', THEME_NS), 'a, abbr, acronym, em, b, i, strike, strong, span'),
                        "id"   =>   "art_footer_content",
                        "std"  =>   art_option('footer.defaultText'),
                        "type" =>   "textarea")
          );

remove_action('wp_head', 'wp_generator');
wp_enqueue_script('jquery');

define('WP_VERSION', $wp_version);
define('THEME_NS', 'kubrick');
if (class_exists('xili_language')):
define('THEME_TEXTDOMAIN',THEME_NS);
define('THEME_LANGS_FOLDER','/lang');
else:
    load_theme_textdomain(THEME_NS, TEMPLATEPATH . '/lang');
endif;

require_once(TEMPLATEPATH . '/core/parser.php');
require_once(TEMPLATEPATH . '/core/navigation.php');
require_once(TEMPLATEPATH . '/core/sidebars.php');
require_once(TEMPLATEPATH . '/core/widgets.php');


function art_option($name){
  global $art_config;
  $separator = '.';
  $name = trim($name);
  if (strpos($name, $separator) !== false) {
    $path = explode($separator, $name);
    $location = $path[0];
    if (isset($art_config[$location])){
      $group = $art_config[$location];
      $key = $path[1];
      if (isset($group[$key])){
        return $group[$key];
      }
    }
  } else {
    if (isset($art_config[$name])) {
      return $art_config[$name];
    }
  }
 
  return false;
}

$art_current_page_template = 'page'; 
function art_page_template($templateName = null){
    global $art_current_page_template;
    if ($templateName !== null) {
        $art_current_page_template = $templateName;
    }
    return $art_current_page_template;
}

$art_template_variables = null;
function art_page_variables($variables = null){
    global $art_template_variables;
    if ($art_template_variables == null){
      $art_template_variables = array(
        'template_url'     =>   get_bloginfo('template_url') . '/',
        'logo_url'         =>   get_option('home'),
        'logo_name'        =>   get_bloginfo('name'),
        'logo_description' =>   get_bloginfo('description'),
        'menu_items'       =>   art_get_menu_auto('primary-menu', art_option('menu.source'), art_option('menu.showSubitems')),
        'sidebar1'         =>   art_get_sidebar('default'),
        'sidebarTop'       =>   art_get_sidebar('top'),
        'sidebarBottom'    =>   art_get_sidebar('bottom'),
        'sidebar2'         =>   art_get_sidebar('secondary'),
        'sidebarFooter'    =>   art_get_sidebar('footer'),
        'footerRSS'        =>   art_get_footer_rss(),
        'footerText'       =>   art_get_footer_text()
        );
    }
    if (is_array($variables)) {
      $art_template_variables = array_merge($art_template_variables, $variables);
    }
    return $art_template_variables;
}

function art_get_footer_text(){
  $result = art_option('footer.defaultText');
  
  $footer_content = get_option('art_footer_content');
  if ($footer_content !== false) {
    $result = stripslashes($footer_content);
  }
  
  return str_replace('%YEAR%', date('Y'), $result);
}


function art_get_footer_rss(){
  $result = '';
  if(art_option('footer.rss_show')){
    $result = art_parse(art_option('footer.rss_link'), array(
      'rss_url'   =>   get_bloginfo('rss2_url'), 
      'rss_title' =>   sprintf(__('%s RSS Feed', THEME_NS), get_bloginfo('name'))
      ));
  }
  return $result;
}

function art_get_post_thumbnail($post_id = false){
	global $post, $id;
  $post_id = (int)$post_id;
  if (!$post_id) $post_id = $id;
  $is_post_list = !is_single() && !is_page();
  $width = art_option('metadata.thumbnail_width');
  $height = art_option('metadata.thumbnail_height');
  $size = array($width, $height);
  if (!$is_post_list) {
    $size = 'medium';
  }
	$result = '';
	$title = get_the_title();
	if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
		ob_start();
		the_post_thumbnail($size, array('class' => 'alignleft', 'alt' => '', 'title' => $title));
		$result = ob_get_clean();
	} else {
		$postimage = get_post_meta($post->ID, 'post-image', true);
		if ($postimage) {
			$result = '<img src="'.$postimage.'" alt="" width="'.$width.'" height="'.$height.'" title="'.$title.'" class="wp-post-image alignleft" />';
		} else if (art_option('metadata.thumbnail_auto') && $is_post_list) {
            $attachments = get_children(array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
            if($attachments) {
              $attachment = array_shift($attachments);
              $img = wp_get_attachment_image_src($attachment->ID, $size);
              if (isset($img[0])) {
                $result = '<img src="'.$img[0].'" alt="" width="'.$img[1].'" height="'.$img[2].'" title="'.$title.'" class="wp-post-image alignleft" />';
              }
            }
        } 
    }  
	if($result !== ''){
		$result = '<a href="'.get_permalink($post->ID).'" title="'.$title.'">'.$result.'</a>';
	}
	return $result;
}

function art_get_the_content($more_link_text = null, $stripteaser = 0) {
	$content = get_the_content($more_link_text, $stripteaser);
	$content = apply_filters('the_content', $content);
	return $content;
}

function art_get_post_content() {
  global $post;
  ob_start();
  if(is_single() || is_page()) {
    echo art_get_the_content(__('Read the rest of this entry &raquo;', THEME_NS)); 
    wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); 
	} else {
    echo art_get_the_excerpt(__('Read the rest of this entry &raquo;', THEME_NS), 
      get_permalink($post->ID), 
      art_option('metadata.excerpt_words'), 
      art_option('metadata.excerpt_use_tag_filter') ? explode(',',art_option('metadata.excerpt_allowed_tags')) : null, 
      art_option('metadata.excerpt_min_remainder'),  
      art_option('metadata.excerpt_auto'));
	}
	return ob_get_clean();
}

function art_get_the_excerpt($read_more_tag, $perma_link_to = '', $all_words = 100,  $allowed_tags = null, $min_remainder = 5, $auto = false) {
  global $post, $id;
  $more_token = '%%art-more%%';
  $show_more_tag = false;
  if (function_exists('post_password_required') && post_password_required($post)){
    return get_the_excerpt();
  }
  if (has_excerpt($id)) {
      $the_contents = get_the_excerpt();
  $show_more_tag = strlen($post->post_content) > 0;
  } else {
    $the_contents = art_get_the_content($more_token);
    if($the_contents != '') {
      if ($allowed_tags !== null) {
        $allowed_tags = '<' .implode('><',$allowed_tags).'>';
        $the_contents = strip_tags($the_contents, $allowed_tags);
      }
      $the_contents = strip_shortcodes($the_contents);
      if (strpos($the_contents, $more_token) !== false) {
        return str_replace($more_token, $read_more_tag, $the_contents);
      }
      if($auto && is_numeric($all_words)) {
        $token = "%art_tag_token%";
        $content_parts = explode($token, str_replace(array('<', '>'), array($token.'<', '>'.$token), $the_contents));
        $content = array();
        $word_count = 0;
        foreach($content_parts as $part)
        {
          if (strpos($part, '<') !== false || strpos($part, '>') !== false){
            $content[] = array('type'=>'tag', 'content'=>$part);
          } else {
             $all_chunks = preg_split('/([\s]+)/', $part, -1, PREG_SPLIT_DELIM_CAPTURE);
             foreach($all_chunks as $chunk) {
                if('' != trim($chunk)) {
                  $content[] = array('type'=>'word', 'content'=>$chunk);
                  $word_count += 1;
                } elseif($chunk != '') {
                  $content[] = array('type'=>'space', 'content'=>$chunk);
                }
             }
          }
        
        }
        if(($all_words < $word_count) && ($all_words + $min_remainder) <= $word_count) {
          $show_more_tag = true;
          $current_count = 0;
          $the_contents = '';
          foreach($content as $node) {
            
            if($node['type'] == 'word') {
              $current_count += 1;
            } 
            $the_contents .= $node['content'];
            if ($current_count == $all_words){
              break;
            }
          }
        }  
      }
    }
  }
  $the_contents = force_balance_tags($the_contents);
  if ($show_more_tag) {
    $the_contents = $the_contents.' <a class="more-link" href="'.$perma_link_to.'">'.$read_more_tag.'</a>';
  }
  return $the_contents;
}


function art_get_post_title() {
    return art_parse_template("post_title", array(
      'post_link'       =>   get_permalink($post->ID),
	    'post_link_title' =>   sprintf(__('Permanent Link to %s', THEME_NS), the_title_attribute('echo=0')),
	    'post_title'      =>   get_the_title(),
	    'template_url'    =>   get_bloginfo('template_url')
	    ));
}
Sigue abajo