Buongiorno a tutti.
Creando una tabella sul mio sito wordpress incorro nel problema che il cms mi aggiunge automaticamente dei
automaticamente vedi esempio:
http://www.friulisitiweb.it/esempio.gif
questo é il codice che genera WP, dopo che ho inserito la tabella:
premetto che ho seguito diverse guide che mi dicevano di modificare il file functions.php, tipo:
http://sww.nz/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
ma non ho risolto. dove sbaglio? dove va collocato il codice in functions.php.
codice functions.php
Vi prego aiutatemi grazie.
Creando una tabella sul mio sito wordpress incorro nel problema che il cms mi aggiunge automaticamente dei
automaticamente vedi esempio:
http://www.friulisitiweb.it/esempio.gif
questo é il codice che genera WP, dopo che ho inserito la tabella:
HTML:
<table border="1" width="200"><br />
<tbody><br />
<tr><br />
<td></td><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
<td></td><br />
</tr><br />
</tbody><br />
</table><br />
</div>
</p>
premetto che ho seguito diverse guide che mi dicevano di modificare il file functions.php, tipo:
http://sww.nz/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
ma non ho risolto. dove sbaglio? dove va collocato il codice in functions.php.
codice functions.php
PHP:
<?php
/**
* Yume functions and definitions
*
* @package Yume
*/
// Include Files
if ( ! function_exists( 'yume_require_files' ) ) :
function yume_require_files() {
require( get_template_directory() . '/functions/widgets.php' );
require( get_template_directory() . '/functions/head-css.php' );
}
endif;
add_action( 'after_setup_theme', 'yume_require_files' );
// Load Options Framework
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', esc_url(get_template_directory_uri() . '/inc/') );
require( get_template_directory() . '/inc/options-framework.php' );
}
// Yume Setup
if ( ! function_exists( 'yume_setup' ) ) :
function yume_setup() {
global $content_width;
if ( ! isset( $content_width ) ) { $content_width = 960; }
register_nav_menu( 'primary', __( 'Top Menu', "yume" ) );
register_nav_menu( 'footer1', __( 'Fotter Menu 1', "yume" ) );
register_nav_menu( 'footer2', __( 'Fotter Menu 2', "yume" ) );
register_nav_menu( 'footer3', __( 'Fotter Menu 3', "yume" ) );
register_nav_menu( 'footer4', __( 'Fotter Menu 4', "yume" ) );
register_nav_menu( 'footer5', __( 'Fotter Menu 5', "yume" ) );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
$custom_header_support = array(
'default-text-color' => '000',
'flex-height' => true,
);
set_post_thumbnail_size( 150, 150, true );
add_image_size( 'large-feature', 600, 480, true );
add_image_size( 'small-feature', 500, 300 );
add_theme_support( 'custom-background');
add_editor_style();
}
endif;
add_action( 'after_setup_theme', 'yume_setup' );
// Loading Files Javascript
if ( ! function_exists( 'yume_of_register_js' ) ) :
function yume_of_register_js() {
wp_enqueue_script('main', get_template_directory_uri() . '/js/main.js', array('jquery'),'1.0', true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
endif;
add_action('wp_enqueue_scripts', 'yume_of_register_js');
function yume_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() ) {
return $title;
}
$title .= get_bloginfo( 'name', 'display' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description";
}
if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'yume' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'yume_wp_title', 10, 2 );
// Yume Credits Footer
if ( ! function_exists( 'yume_credits' ) ) :
function yume_credits() {
$text = 'Theme created by <a href="'.esc_url('http://www.pwtthemes.com/').'">PWT</a>. Powered by <a href="'.esc_url('http://wordpress.org/').'">WordPress.org</a>';
echo apply_filters('yume_credits', $text);
}
endif;
add_action( 'yume_display_credits', 'yume_credits' );
// Extracting List Posts
if ( ! function_exists( 'yume_get_list_posts' ) ) :
function yume_get_list_posts() {
global $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged
);
$wp_query->query( $args );
return new WP_Query($args);
}
endif;
// Extracting List Pages
if ( ! function_exists( 'yume_get_list_pages' ) ) :
function yume_get_list_pages() {
global $wp_query;
$args = array(
'post_type' => 'page',
'posts_per_page' => -1
);
$wp_query->query( $args );
return new WP_Query( $args );
}
endif;
// Extracting Name Menu
if ( ! function_exists( 'yume_get_name_menu' ) ) :
function yume_get_name_menu($menu) {
$yume_menu_locations = get_nav_menu_locations();
$yume_menu_object = (isset($yume_menu_locations[$menu]) ? wp_get_nav_menu_object($yume_menu_locations[$menu]) : null);
$yume_menu_name = (isset($yume_menu_object->name) ? $yume_menu_object->name : '');
echo esc_html($yume_menu_name);
}
endif;
// Yume Position Sidebar
if ( ! function_exists( 'yume_position_sidebar' ) ) :
function yume_position_sidebar() {
if(of_get_option('default_layout')=='right') {
$text = 'right_sidebar';
}
if(of_get_option('default_layout')=='left') {
$text = 'left_sidebar';
}
if(of_get_option('default_layout')=='none') {
$text = 'nosidebar';
}
echo apply_filters('yume_position_sidebar', $text);
}
endif;
add_action( 'yume_display_ps', 'yume_position_sidebar' );
function comment_reform ($arg) {
$arg['title_reply'] = __('Lascia un commento');
return $arg;
}
add_filter('comment_form_defaults','comment_reform');
function change_footer_admin_text() {
echo 'Il vostro testo';
}
add_filter('admin_footer_text', 'change_footer_admin_text');
// Pagenavi
function kode_pagenavi( $p = 10 ) { // pagine da visualizzare prima e dopo la pagina corrente
if ( is_singular() ) return;
global $wp_query, $paged;
$max_page = $wp_query->max_num_pages;
if ( $max_page == 1 ) return;
if ( empty( $paged ) ) $paged = 1;
echo '<span class="meta-normal">Pagina → ' . $paged . ' di ' . $max_page . '</span>';
if ( $paged > $p + 1 ) p_link( 1, 'Prima' );
if ( $paged > $p + 2 ) echo '←';
for( $i = $paged - $p; $i <= $paged + $p; $i++ ) {
if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "<span class='page-numbers currentpage'>{$i}</span> " : p_link( $i );
}
if ( $paged < $max_page - $p - 1 ) echo '→';
if ( $paged < $max_page - $p ) p_link( $max_page, 'Ultima' );
}
function p_link( $i, $title = '' ) {
if ( $title == '' ) $title = "Pagina → {$i}";
echo "<span class='page-numbers'><a href='", esc_html( get_pagenum_link( $i ) ), "' title='{$title}'>{$i}</a></span>";
}
//
function add_meta_tag(){
global $wp_query;
$post = $wp_query->get_queried_object();
$desc = get_bloginfo('description');
$keys = " ";
if(is_single() || is_page()){
$desc = cut($post->post_content, 25);
}
if(is_single()){
$keywords = array();
$tags = get_the_tags($post->ID);
$categories = get_the_category($post->ID);
if(is_array($tags)){
foreach ($tags as $tag)
$keywords[] = $tag->name;
}
if(is_array($categories)){
foreach ($categories as $category)
$keywords[] = $category->cat_name;
}
$keys = implode(", ", $keywords);
}
if(is_category()){
$desc = strip_tags(category_description());
}
$desc = str_replace(array("\n","\r","\t"), " ", $desc);
$desc = str_replace('"', "'", $desc);
echo '<meta name="description" content="' . $desc . '" />' . "\n";
echo '<meta name="keywords" content="'. $keys . '" />' . "\n";
}
add_action('wp_head', 'add_meta_tag');
function cut($content, $cut = 0, $encode_html = 0) {
if ( $cut && !$encode_html )
$encode_html = 2;
if ( 1== $encode_html ) {
$content = wp_specialchars($content);
$cut = 0;
} elseif ( 0 == $encode_html ) {
$content = make_url_footnote($content);
} elseif ( 2 == $encode_html ) {
$content = strip_tags($content);
}
if ( $cut ) {
$blah = explode(' ', $content);
if ( count($blah) > $cut ) {
$k = $cut;
$use_dotdotdot = 1;
} else {
$k = count($blah);
$use_dotdotdot = 0;
}
for ( $i=0; $i<$k; $i++ )
$excerpt .= $blah[$i].' ';
$excerpt .= ($use_dotdotdot) ? '...' : '';
$content = $excerpt;
}
$content = str_replace(']]>', ']]>', $content);
return $content;
}
?>
Vi prego aiutatemi grazie.
Ultima modifica: