我有wordpress网站。我想用我的png图像更改块的图标,但我不能因为它需要在PHP函数中进行更改。
怎么样:
我想成为:
PHP代码:
<?php
$home_blocks = $tugdmedia['home_sort_id'];
if ($home_blocks):
foreach ($home_blocks as $key=>$value) {
switch($key) {
//Blocks
case 'blocks': ?>
<div class="home_blocks ast_blocks"><?php get_template_part('frontpage/content','blocks'); ?></div>
功能代码:
$sections[] = array(
'type' => 'divide',
);
$sections[] = array(
'icon' => 'home-alt',
'icon_class' => 'icon-large',
'title' => __('Front Page ', 'tugdmedia'),
'fields' => array(
array(
'id'=>'block1_text_id',
'type' => 'text',
'title' => __('Block 1 Title', 'tugdmedia'),
'default' => 'Lorem Ipsum'
),
array(
'id'=>'block1_icon',
'type' => 'select',
'title' => __('Block 1 Icon', 'tugdmedia'),
'data' => 'elusive',//Must provide key => value pairs for select options
'default' => 'fa-camera'
),
array(
'id'=>'block1_link_id',
'type' => 'text',
'title' => __('Block 1 Link', 'tugdmedia')
),
array(
'id'=>'block1_textarea_id',
'type' => 'editor',
'title' => __('Block 1 Content', 'tugdmedia'),
'default' => 'Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.',
),
array(
'id'=>'block2_text_id',
'type' => 'text',
'title' => __('Block 2 Title', 'tugdmedia'),
'default' => 'Lorem Ipsum'
),
array(
'id'=>'block2_icon',
'type' => 'select',
'title' => __('Block 2 Icon', 'tugdmedia'),
'data' => 'elusive',//Must provide key => value pairs for select options
'default' => 'fa-rocket'
),
array(
'id'=>'block2_link_id',
'type' => 'text',
'title' => __('Block 2 Link', 'tugdmedia')
),
array(
'id'=>'block2_textarea_id',
'type' => 'editor',
'title' => __('Block 2 Content', 'tugdmedia'),
'default' => 'Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.',
),
array(
'id'=>'block3_text_id',
'type' => 'text',
'title' => __('Block 3 Title', 'tugdmedia'),
'default' => 'Lorem Ipsum'
),
array(
'id'=>'block3_icon',
'type' => 'select',
'title' => __('Block 3 Icon', 'tugdmedia'),
'data' => 'elusive',//Must provide key => value pairs for select options
'default' => 'fa-signal'
),
array(
'id'=>'block3_link_id',
'type' => 'text',
'title' => __('Block 3 Link', 'tugdmedia')
),
array(
'id'=>'block3_textarea_id',
'type' => 'editor',
'title' => __('Block 3 Content', 'tugdmedia'),
'default' => 'Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.',
),
array(
'id'=>'block4_text_id',
'type' => 'text',
'title' => __('Block 4 Title', 'tugdmedia'),
'default' => 'Lorem Ipsum'
),
array(
'id'=>'block4_icon',
'type' => 'select',
'title' => __('Block 4 Icon', 'tugdmedia'),
'data' => 'elusive',
'default' => 'fa-cogs'
),
array(
'id'=>'block4_link_id',
'type' => 'text',
'title' => __('Block 4 Link', 'tugdmedia')
),
array(
'id'=>'block4_textarea_id',
'type' => 'editor',
'title' => __('Block 4 Content', 'tugdmedia'),
'default' => 'Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.',
),
array(
'id'=>'welcm_textarea_id',
'type' => 'editor',
'title' => __('Welcome Text', 'tugdmedia'),
'default' => '<h2>Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.</h2>',
),
array(
'id'=>'welcome_color_id',
'type' => 'color',
'title' => __('Background Color ', 'tugdmedia'),
'default' => '#333333',
'validate' => 'color',
),
array(
'id'=>'posts_title_id',
'type' => 'editor',
'title' => __('Title & Description', 'tugdmedia'),
'default' => '<h2 style="text-align: center;"><span style="color: #e2341d;">Check Out Our Portfolio</span></h2><p style="text-align: center;">The Very recent work for our clients</p>',
),
array(
'id'=>'front_layout_id',
'type' => 'image_select',
'compiler'=>true,
'title' => __('Posts layout', 'tugdmedia'),
'options' => array(
'1' => array('alt' => 'Layout 1', 'img' => get_template_directory_uri().'/images/layout1.png'),
),
'default' => '1'
),
array(
'id'=>'enable_cat',
'type' => 'switch',
'title' => __('Display posts from selected Categories', 'tugdmedia'),
"default" => 0,
),
array(
'id'=>'posts_cat_id',
'type' => 'select',
'data' => 'categories',
'multi' => true,
'title' => __('Category Names', 'tugdmedia'),
),
array(
'id'=>'n_posts_field_id',
'type' => 'text',
'title' => __('Number of Posts ', 'tugdmedia'),
'default' => '9',
),
array(
'id'=>'map-info',
'type' => 'info',
'desc' => __("This feature is only available in tugdmedia PRO", "tugdmedia"),
),
array(
'id'=>'callaction-info',
'type' => 'info',
'desc' => __("This feature is only available in tugdmedia PRO", "tugdmedia"),
),
array(
'id'=>'widget-info',
'type' => 'info',
'desc' => __("This feature is only available in tugdmedia PRO", "tugdmedia"),
),
array(
'id' => 'home_sort_id',
'type' => 'sortable',
'mode' => 'checkbox', // checkbox or text
'title' => __('Frontpage Elements position', 'tugdmedia'),
'desc' => __('Drag and Drop each element to reorder their position.', 'tugdmedia'),
'options' => array(
'blocks' => 'Blocks',
'welcome-text' => 'Welcome Text',
'posts' => 'Frontpage Posts'
),
'default' => array(
'blocks' => 'Blocks',
'welcome-text' => 'Welcome Text',
'posts' => 'Frontpage Posts'
)
),
)
);
如果需要更多信息,我会立即回答。顺便说一句,您可以使用自己的网站查看我的网站:enter link description here
答案 0 :(得分:1)
您只需更改content-blocks.php即可。转到名为:frontbage。
的文件夹