如何在Wordpress中更改函数的一部分

时间:2015-01-07 11:20:57

标签: php wordpress

我正忙着修改来自themeforest的高级wordpress主题,在更改图像缩略图大小时遇到​​了一些麻烦。

有这个功能:

function apicona_setup() {
/*
 * Makes Apicona available for translation.
 *
 * Translations can be added to the /languages/ directory.
 * If you're building a theme based on Apicona, use a find and
 * replace to change 'apicona' to the name of your theme in all
 * template files.
 */
load_theme_textdomain( 'apicona', get_template_directory() . '/languages' );

// Adds RSS feed links to <head> for posts and comments.
add_theme_support( 'automatic-feed-links' );

// Adding WooCommerce Support
add_theme_support( 'woocommerce' );

/*
 * Switches default core markup for search form, comment form,
 * and comments to output valid HTML5.
 */
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );

/*
 * This theme supports all available post formats by default.
 * See http://codex.wordpress.org/Post_Formats
 */
add_theme_support( 'post-formats', array(
    'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'
) );

// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Navigation Menu', 'apicona' ) );
register_nav_menu( 'footer' , __( 'Footer Menu', 'apicona' ) );


/*
 * This theme uses a custom image size for featured images, displayed on
 * "standard" posts and pages.
 */
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 727, 409, true );

// Adding Image sizes
add_image_size( 'portfolio-two-column',   1110, 624, true );
add_image_size( 'portfolio-three-column', 720, 406, true );
add_image_size( 'portfolio-four-column',  526, 296, true );
add_image_size( 'woocommerce-catalog',    520, 520, true );
add_image_size( 'woocommerce-single',     800, 800, true );
add_image_size( 'woocommerce-thumbnail',  120, 120, true );


// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );

// Run Shortcode in Widget Title
add_filter('widget_title', 'do_shortcode');

// Run Shortcode in text widget
add_filter('widget_text', 'do_shortcode');


// CF Post Format
// include_once('inc/plugins/cf-post-formats/cf-post-formats.php');


// Widgets
include_once('inc/widgets/kwayyWidgetRecentPosts.php');
include_once('inc/widgets/kwayyWidgetFlickr.php');
include_once('inc/widgets/kwayyWidgetContact.php');
//include_once('inc/widgets/kwayyWidgetTabs.php');

}
add_action( 'after_setup_theme', 'apicona_setup' );

我需要的是“删除”这个小部分:

/*
 * This theme uses a custom image size for featured images, displayed on
 * "standard" posts and pages.
 */
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 727, 409, true );

// Adding Image sizes
add_image_size( 'portfolio-two-column',   1110, 624, true );
add_image_size( 'portfolio-three-column', 720, 406, true );
add_image_size( 'portfolio-four-column',  526, 296, true );
add_image_size( 'woocommerce-catalog',    520, 520, true );
add_image_size( 'woocommerce-single',     800, 800, true );
add_image_size( 'woocommerce-thumbnail',  120, 120, true );

任何建议,或有人为我提供可以执行此操作的代码?我从实际结果中学到了更多,并解释了它是如何工作的,然后是一个实际的教程如何构建它。 (对于那些想知道:P)

提前致谢!

编辑* 我希望通过子主题functions.php完成此操作。由于更新需要我重新删除脚本

0 个答案:

没有答案