Erro de linha

10/09/2015

0

PHP

Meu site aparece a seguinte mensagem : Parse error: syntax error, unexpected T_DEFAULT in /home/****/public_html/wp-content/themes/*******/functions.php on line 1

O que poderia estar ocasionando esse erro? Aqui está o arquivo em questão:

<?php
//translatable theme
load_theme_textdomain( 'orizon', get_template_directory() . '/langs');
?>
<?php
require_once('widgets/latest_twitter/latest_twitter_widget.php');
require_once('themeOptions/functions.php');
require_once('themeOptions/rating.php');
require_once('widgets/rating/popular-widget.php');
require_once('post_templates.php');
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );




add_action( 'after_setup_theme', 'orizon_theme_tweak' );
function orizon_theme_tweak(){
// When this theme is activated send the user to the theme options
if (is_admin() && isset($_GET['activated'] ) ) {
// Call action that sets
add_action('admin_head','gp_setup');
// Do redirect
header( 'Location: '.admin_url().'themes.php?page=options-framework' ) ;
}
/*register theme location menu*/
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' , 'orizon'),
)
);
}
}

/*add custom menu support*/
add_theme_support( 'menus' );
add_action( 'admin_menu', 'orizon_create_menu' );
function orizon_create_menu(){
$themeicon1 = get_template_directory_uri()."/images/favicon.png";
add_menu_page("Theme Options", "Theme Options", 'edit_theme_options', 'options-framework', 'optionsframework_page',$themeicon1,1800 );
}

/*admin styles*/
add_action('admin_init', 'orizon_styles_admin');
function orizon_styles_admin(){
wp_register_style( 'custom-style11', get_template_directory_uri().'/css/font-awesome.css', array(), '20140401');
wp_enqueue_style( 'custom-style11' );
wp_register_style( 'custom-style22', get_template_directory_uri().'/css/font-awesome.min.css', array(), '20140401');
wp_enqueue_style( 'custom-style22' );
}

/*theme styles*/
add_action( 'wp_enqueue_scripts', 'orizon_mytheme_style' );
function orizon_mytheme_style() {
wp_enqueue_style( 'orizon_mytheme_style-style', get_bloginfo( 'stylesheet_url' ), array(), '20140401' );
}

/*theme scripts*/
add_action('wp_enqueue_scripts', 'orizon_my_scripts');
function orizon_my_scripts(){
wp_enqueue_script('jquery');
if(of_get_option('scrollbar') == 1){
wp_register_script( 'custom_js1', get_template_directory_uri().'/js/theme.min.js','','',true);
wp_enqueue_script('custom_js1');
}

wp_register_script( 'custom_js2', get_template_directory_uri().'/js/jquery.kwicks.min.js','','',true);
wp_enqueue_script('custom_js2');
wp_register_script( 'custom_js3', get_template_directory_uri().'/js/kwicks-settings.js','','',true);
wp_enqueue_script('custom_js3');
wp_register_script( 'custom_js4', get_template_directory_uri().'/js/jquery.carouFredSel-6.2.1-packed.js','','',true);
wp_enqueue_script('custom_js4');
wp_register_script( 'custom_js5', get_template_directory_uri().'/js/jquery.cslider.js','','',true);
wp_enqueue_script('custom_js5');
wp_register_script( 'custom_js6', get_template_directory_uri().'/js/jquery.validationEngine.js','','',true);
wp_enqueue_script('custom_js6');
wp_register_script( 'custom_js7', get_template_directory_uri().'/js/jquery.validationEngine-en.js','','',true);
wp_enqueue_script('custom_js7');
wp_register_script( 'custom_js8', get_template_directory_uri().'/js/jquery.bxSlider.js','','',true);
wp_enqueue_script('custom_js8');
wp_register_script( 'custom_js9', get_template_directory_uri().'/js/modernizr.custom.28468.js','','',true);
wp_enqueue_script('custom_js9');
wp_register_script( 'custom_js10', get_template_directory_uri().'/js/parallax.js','','',true);
wp_enqueue_script('custom_js10');
wp_register_script( 'ajaxcomments', get_template_directory_uri().'/js/ajaxcomments.js','','',true);
wp_enqueue_script('ajaxcomments');
wp_localize_script('ajaxcomments', 'orizon_script_vars', array(
'success' => __('Thanks for your comment. We appreciate your response.', 'orizon'),
'error' => __('Please wait a while before posting your next comment!', 'orizon'),
'info' => __('Processing...', 'orizon'),
'error2' => __('You might have left one of the fields blank, or be posting too quickly!', 'orizon')

)
);
wp_register_script( 'custom_js11', get_template_directory_uri().'/js/global.js','','',true);
wp_enqueue_script('custom_js11');
}


add_action('wp', 'orizon_deregister', 100 );
function orizon_deregister(){
if (is_home()) {
function orizon_de_script() {
wp_deregister_script( 'sk_tweenlight' );
wp_deregister_script( 'sk_tweenmax' );
}
add_action('wp_print_scripts', 'orizon_de_script', 100 );
}}

// Pagination fucntion
function kriesi_pagination($pages = '', $range = 1){
$showitems = ($range * 1)+1;
$general_show_page = of_get_option('general_post_show');
global $paged;
global $paginate;
if(empty($paged)) $paged = 1;
if($pages == ''){
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages){
$pages = 1;
}
}if(1 != $pages){
$url= get_template_directory_uri();
if (of_get_option('color_scheme')=="0" or of_get_option('color_scheme')=="1") {
$leftpager= $url.'/css/red_css/images/left_pager.jpg';
$rightpager= $url.'/css/red_css/images/right_pager.jpg';
}
if (of_get_option('color_scheme')=="2") {
$leftpager= $url.'/css/blue_css/images/left_pager.jpg';
$rightpager= $url.'/css/blue_css/images/right_pager.jpg';
}
if($paged > 2 && $paged > $range+1 && $showitems < $pages) $paginate.= "";
if($paged > 1 ) $paginate.= "<a href='".get_pagenum_link($paged - 1)."'>
<img class='left' src=".$leftpager.">
</a>";
for ($i=1; $i <= $pages; $i++){
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){
$paginate.= ($paged == $i)? "<li><a href='".get_pagenum_link($i)."' class='active'>".$i."</a></li>":"<li><a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a></li>";
}
}if ($paged < $pages ) $paginate.= "<li><a href='".get_pagenum_link($paged + 1)."' >
<img class='right' src=".$rightpager.">
</a></li>";
}
return $paginate;
}

/*add featured image support*/
add_theme_support( 'post-thumbnails' );

// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );

// Standard Excerpt length
add_filter('excerpt_length', 'orizon_excerpt_length');
function orizon_excerpt_length($length) {
return 60;
}

// Special excerpt length per instance ie showcase column excerpts
function excerpt($num) {
$limit = $num+1;
$excerpt = explode(' ', get_the_excerpt(), $limit);
array_pop($excerpt);
$excerpt = implode(" ",$excerpt)."...";
echo $excerpt;
}

// change the excerpt ending
add_filter('excerpt_more', 'new_excerpt_more');
function new_excerpt_more($more) {
return '...';
}

// function for create a pages when we install a theme
function create_initial_pages() {
require( get_template_directory() . '/inc/page_content.php' );
$pages = array(
'Home' => "$Home",
'About us' => "$About_us",
'Services' => "$Services",
'Contact' => "$Contact",
);
foreach($pages as $key => $value) {
$id = get_page_by_title($key);
$page = array(
'post_type' => 'page',
'post_title' => $key,
'post_status' => 'publish',
'post_author' => 1,
'post_parent' => '',
'post_content'=> $value
);
if (!isset($id)) wp_insert_post($page);
}}


/*image resize*/
function aq_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {

// Validate inputs.
if ( ! $url || ( ! $width && ! $height ) ) return false;

// Caipt'n, ready to hook.
if ( true === $upscale ) add_filter( 'image_resize_dimensions', 'aq_upscale', 10, 6 );

// Define upload path & dir.
$upload_info = wp_upload_dir();
$upload_dir = $upload_info['basedir'];
$upload_url = $upload_info['baseurl'];

$http_prefix = "http://";
$https_prefix = "https://";

/* if the $url scheme differs from $upload_url scheme, make them match
if the schemes differe, images don't show up. */
if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well
$upload_url = str_replace($http_prefix,$https_prefix,$upload_url);
}
elseif(!strncmp($url,$http_prefix,strlen($http_prefix))){ //if url begins with http:// make $upload_url begin with http:// as well
$upload_url = str_replace($https_prefix,$http_prefix,$upload_url);
}


// Check if $img_url is local.
if ( false === strpos( $url, $upload_url ) ) return false;

// Define path of image.
$rel_path = str_replace( $upload_url, '', $url );
$img_path = $upload_dir . $rel_path;

// Check if img path exists, and is an image indeed.
if ( ! file_exists( $img_path ) or ! getimagesize( $img_path ) ) return false;

// Get image info.
$info = pathinfo( $img_path );
$ext = $info['extension'];
list( $orig_w, $orig_h ) = getimagesize( $img_path );

// Get image size after cropping.
$dims = image_resize_dimensions( $orig_w, $orig_h, $width, $height, $crop );
$dst_w = $dims[4];
$dst_h = $dims[5];

// Return the original image only if it exactly fits the needed measures.
if ( ! $dims && ( ( ( null === $height && $orig_w == $width ) xor ( null === $width && $orig_h == $height ) ) xor ( $height == $orig_h && $width == $orig_w ) ) ) {
$img_url = $url;
$dst_w = $orig_w;
$dst_h = $orig_h;
} else {
// Use this to check if cropped image already exists, so we can return that instead.
$suffix = "{$dst_w}x{$dst_h}";
$dst_rel_path = str_replace( '.' . $ext, '', $rel_path );
$destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";

if ( ! $dims || ( true == $crop && false == $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
// Can't resize, so return false saying that the action to do could not be processed as planned.
return false;
}
// Else check if cache exists.
elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
}
// Else, we resize the image and return the new resized image url.
else {

// Note: This pre-3.5 fallback check will edited out in subsequent version.
if ( function_exists( 'wp_get_image_editor' ) ) {

$editor = wp_get_image_editor( $img_path );

if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
return false;

$resized_file = $editor->save();

if ( ! is_wp_error( $resized_file ) ) {
$resized_rel_path = str_replace( $upload_dir, '', $resized_file['path'] );
$img_url = $upload_url . $resized_rel_path;
} else {
return false;
}

} else {

$resized_img_path = wp_get_image_editor( $img_path, $width, $height, $crop ); // Fallback foo.
if ( ! is_wp_error( $resized_img_path ) ) {
$resized_rel_path = str_replace( $upload_dir, '', $resized_img_path );
$img_url = $upload_url . $resized_rel_path;
} else {
return false;
}

}

}
}

// Okay, leave the ship.
if ( true === $upscale ) remove_filter( 'image_resize_dimensions', 'aq_upscale' );

// Return the output.
if ( $single ) {
// str return.
$image = $img_url;
} else {
// array return.
$image = array (
0 => $img_url,
1 => $dst_w,
2 => $dst_h
);
}

return $image;
}


function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
if ( ! $crop ) return null; // Let the wordpress default function handle this.

// Here is the point we allow to use larger image size than the original one.
$aspect_ratio = $orig_w / $orig_h;
$new_w = $dest_w;
$new_h = $dest_h;

if ( ! $new_w ) {
$new_w = intval( $new_h * $aspect_ratio );
}

if ( ! $new_h ) {
$new_h = intval( $new_w / $aspect_ratio );
}

$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );

$crop_w = round( $new_w / $size_ratio );
$crop_h = round( $new_h / $size_ratio );

$s_x = floor( ( $orig_w - $crop_w ) / 2 );
$s_y = floor( ( $orig_h - $crop_h ) / 2 );

return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
}


//Comment form and Comment Text Display with function.
function Orizon_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p>
<?php _e( 'Pingback:', 'orizon' ); ?>
<?php comment_author_link(); ?>
<?php edit_comment_link( __( 'Edit', 'orizon' ), '<span class="edit-link">', '</span>' ); ?>
</p>
<?php
break;
default :
?>
<li> <img alt="alt_example" class="indent" src="<?php echo get_template_directory_uri();?>/css/red_css/images/post/indent.jpg" />
<div class="avatar">
<?php
$avatar_size = 68;
if ( '0' != $comment->comment_parent )
$avatar_size = 39;
echo get_avatar( $comment, $avatar_size );?>
</div>
<div class="comment">
<p><?php printf( '<strong >%s</strong> ', get_comment_author_link() ); ?><small>
<?php
printf( sprintf( __( '%1$s at %2$s', 'orizon' ), get_comment_date(), get_comment_time()));?>
-
<?php
comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply ', 'orizon' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) );
?>
</a></small></p>
<?php edit_comment_link( __( 'Edit', 'orizon' ), '<span class="edit-link">', '</span>' ); ?>
<?php if ( $comment->comment_approved == '0' ) : ?>
<em class="comment-awaiting-moderation">
<?php _e( 'Your comment is awaiting moderation.', 'orizon' ); ?>
</em> <br />
<?php endif;
comment_text(); ?>
</div>
<?php
break;
endswitch;
}


/*
* Include the TGM_Plugin_Activation class.
*/
require_once dirname( __FILE__ ) . '/pluginactivation.php';
add_action( 'tgmpa_register', 'orizon_my_theme_register_required_plugins' );
/*
* Register the required plugins for this theme.
*
* In this example, we register two plugins - one included with the TGMPA library
* and one from the .org repo.
*
* The variable passed to tgmpa_register_plugins() should be an array of plugin
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function orizon_my_theme_register_required_plugins() {
/**
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// This is an example of how to include a plugin pre-packaged with a theme
array(
'name' => 'Parallax slider', // The plugin name
'slug' => 'layerslider', // The plugin slug (typically the folder name)
'source' => 'http://skywarriorthemes.com/plugins/layerslider.zip', // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
),array(
'name' => 'Isotope gallery', // The plugin name
'slug' => 'sk_isotope_gallery', // The plugin slug (typically the folder name)
'source' => 'http://skywarriorthemes.com/plugins/sk_isotope_gallery.zip', // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
),array(
'name' => 'BBpress', // The plugin name
'slug' => 'bbpress', // The plugin slug (typically the folder name)
'source' => 'http://skywarriorthemes.com/plugins/bbpress.zip', // The plugin source
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
),

);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'orizon';
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme.
'default_path' => '', // Default absolute path to pre-packaged plugins
'parent_menu_slug' => 'themes.php', // Default parent menu slug
'parent_url_slug' => 'themes.php', // Default parent URL slug
'menu' => 'install-required-plugins', // Menu slug
'has_notices' => true, // Show admin notices or not
'is_automatic' => true, // Automatically activate plugins after installation or not
'message' => '', // Message to output right before the plugins table
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'orizon' ),
'menu_title' => __( 'Install Plugins', 'orizon' ),
'installing' => __( 'Installing Plugin: %s', 'orizon' ), // %1$s = plugin name
'oops' => __( 'Something went wrong with the plugin API.', 'orizon' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s)
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s)
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s)
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s)
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
'return' => __( 'Return to Required Plugins Installer', 'orizon' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'orizon' ),
'complete' => __( 'All plugins installed and activated successfully. %s', 'orizon' ), // %1$s = dashboard link
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
)
);
tgmpa( $plugins, $config );
}


//limit string function
function string_limit_words($string, $word_limit){
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}


/*register sidebars*/
add_action( 'after_setup_theme', 'orizon_register_sidebars' );
function orizon_register_sidebars() {
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => __( 'Home sidebar', 'orizon' ),
'id' => 'home',
'description' => __( 'Widgets in this area will be shown in the home page.' , 'orizon'),
'before_widget' => '<div class="right_navi">',
'after_widget' => '<div class="bootom_image"></div></div>',
'before_title' => '<div class="latest_text"><h1>',
'after_title' => '</h1></div>', ));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => __( 'Blog sidebar', 'orizon' ),
'id' => 'blog',
'description' => __( 'Widgets in this area will be shown in the blog page.' , 'orizon'),
'before_widget' => '<div class="right_navi">',
'after_widget' => '<div class="bootom_image"></div></div>',
'before_title' => '<div class="latest_text"><h1>',
'after_title' => '</h1></div>', ));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => __( 'Page sidebar', 'orizon' ),
'id' => 'page',
'description' => __( 'Widgets in this area will be shown in the pages.' , 'orizon'),
'before_widget' => '<div class="right_navi">',
'after_widget' => '</div>',
'before_title' => '<h1>',
'after_title' => '</h1>', ));
if ( is_plugin_active( 'buddypress/bp-loader.php' ) || is_plugin_active( 'bbpress/bbpress.php' ) ) {
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'BuddyPress/BBpress Sidebar',
'id' => 'buddypress',
'description' => __( 'Widgets in this area will be shown in the BuddyPress/BBpress sidebar.' , ''),
'before_widget' => '<div class="right_navi">',
'after_widget' => '<div class="bootom_image"></div></div>',
'before_title' => '<div class="latest_text"><h1>',
'after_title' => '</h1></div>', ));
}
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => __( 'Footer area widgets', 'orizon' ),
'id' => 'footer1',
'description' => __( 'Widgets in this area will be shown in the footer.' , 'orizon'),
'before_widget' => '<div class="footer_widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>', ));

}



/* Breadcrumbs */

function orizon_pg(){
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'tmp-blog-right.php'
));
foreach($pages as $page){
return $page->post_name;
}}

function orizon_pg1(){
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'tmp-blog-isotope.php'
));
foreach($pages as $page){
return $page->post_name;
}}

function orizon_pg2(){
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'tmp-blog-full.php'
));
foreach($pages as $page){
return $page->post_name;
}}

function orizon_pg3(){
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'tmp-blog-left.php'
));
foreach($pages as $page){
return $page->post_name;
}}

function orizon_get_page_id($name){
global $wpdb;
/* get page id using custom query */
$page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE ( post_name = '".$name."' or post_title = '".$name."' ) and post_status = 'publish' and post_type='page' ");
return $page_id;
}

function orizon_get_page_permalink($name){
$page_id = orizon_get_page_id($name);
return get_permalink($page_id);
}

function orizon_breadcrumbs_inner(){

if (!is_home()) {
echo '<a href="';
echo home_url();
echo '">';
echo __('Home', 'orizon');
echo "</a> // ";
if (is_single()) {
if(get_post_type( get_the_ID() ) == 'portfolio'){
if(!of_get_option('portfolio_breadcrumbs')){$breadcrumb = "Portfolio";
}else{
$breadcrumb = of_get_option('portfolio_breadcrumbs');
};
echo __($breadcrumb, 'orizon');
if (is_single()) {
echo " // ";
the_title();
}
}else{
echo '<a href="';
if(orizon_pg() != null){
echo orizon_get_page_permalink(''. orizon_pg());
}elseif(orizon_pg1() != null){
echo orizon_get_page_permalink(''. orizon_pg1());
}elseif(orizon_pg2() != null){
echo orizon_get_page_permalink(''. orizon_pg2());
}elseif(orizon_pg3() != null){
echo orizon_get_page_permalink(''. orizon_pg3());
}
echo '">';
echo __('Blog', 'orizon');
echo "</a> ";
if (is_single()) {
echo " // ";
the_title();
}
}
}elseif(is_category()){
echo __('Category: ', 'orizon');
echo single_cat_title();
}elseif(is_404()){
echo '404';
}elseif(is_search()){
echo __('Search: ', 'orizon');
echo get_search_query();
}elseif(is_author()){

$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); _e('Author: ', 'orizon'); echo $curauth->user_nicename;
} elseif (is_page()) {
echo the_title();
}elseif(is_tag()){
echo __('Tag: ', 'orizon');
echo GetTagName(get_query_var('tag_id'));
}elseif(is_archive()){
echo __('Archive', 'orizon');
}
}
}

function orizon_breadcrumbs(){

if(function_exists('is_bbpress')){
if(is_bbpress()){
bbp_breadcrumb();
}else{
orizon_breadcrumbs_inner();}
}else{
orizon_breadcrumbs_inner();
}
}
add_filter('wp_list_categories', 'cat_count_span');
function cat_count_span($links) {
$links = str_replace('</a> (', ' <span>(', $links);
$links = str_replace(')', ')</span></a>', $links);
return $links;
}
/* This code filters the Archive widget to include the post count inside the link */
add_filter('get_archives_link', 'archive_count_span');
function archive_count_span($links) {
$links = str_replace('</a> (', ' <span>(', $links);
$links = str_replace(')', ')</span></a>', $links);
return $links;
}
?>
Samuel

Samuel

Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar