2016-04-12 13 views
0

Her yeni gönderinin aynı bilgilerle doldurulabilmesi için özel bir wordpress sayfa şablonuna içerik eklemek istiyorum.İçerik için wordpress sayfa düzenine ekleyin

Ben temelde örneğin özel bir şablon kullanarak doldurmak ön istiyorum bir sayfa tasarımını, üretti kısa kod (görsel besteci eklentisi) kullanarak bir sayfa tasarımını oluşturduk

: Tek release.php ...

sayfa şablonu:

<?php 
/* 
** page.php 
** mk_build_main_wrapper : builds the main divisions that contains the content. Located in framework/helpers/global.php 
** mk_get_view gets the parts of the pages, modules and components. Function located in framework/helpers/global.php 
*/ 

get_header(); 


Mk_Static_Files::addAssets('mk_button'); 
Mk_Static_Files::addAssets('mk_audio'); 
Mk_Static_Files::addAssets('mk_swipe_slideshow'); 

mk_build_main_wrapper(mk_get_view('singular', 'wp-page', true)); 

get_footer(); 

Ben önceden doldurabilirsiniz isteyen içeriği:

[mk_page_section bg_color="#202020" attachment="fixed" bg_position="center top" bg_repeat="no-repeat" bg_stretch="true" js_vertical_centered="true" padding_top="70" padding_bottom="30" sidebar="sidebar-1"][vc_column width="1/3"][vc_single_image source="featured_image" img_size="large"][/vc_column][vc_column width="2/3"][vc_row_inner][vc_column_inner width="1/2"][vc_column_text el_class="t"]ARTIST[/vc_column_text][mk_custom_sidebar el_class="title" sidebar="sidebar-19"][vc_column_text el_class="trackname"]RELEASE: [acf field="track_name"][/vc_column_text][vc_column_text margin_bottom="30" el_class="date"]RELEASE DATE: [acf field="release_date"][/vc_column_text][vc_column_text el_class="date"]TRACKS[/vc_column_text][vc_column_text el_class="track"]01. [acf field="track_01"][/vc_column_text][vc_column_text el_class="track"]02. [acf field="track_02"][/vc_column_text][vc_column_text el_class="track"]04. [acf field="track_03"][/vc_column_text][vc_column_text el_class="track"]03. [acf field="track_04"][/vc_column_text][vc_column_text el_class="track"]05. [acf field="track_05"][/vc_column_text][mk_padding_divider size="20"][/vc_column_inner][vc_column_inner el_class="columnbuttons" width="1/2"][vc_column_text el_class="trackname"]PURCHASE:[/vc_column_text][mk_custom_sidebar el_class="buybutton" sidebar="sidebar-18"][vc_column_text el_class="trackname"]LISTEN[/vc_column_text][vc_column_text el_class="track"][acf field="audio_embed"][/vc_column_text][/vc_column_inner][/vc_row_inner][/vc_column][/mk_page_section][mk_page_section bg_color="#303030" padding_top="40" padding_bottom="40" sidebar="sidebar-1"][vc_column][mk_fancy_title color="#f2f2f2" size="20" font_weight="300" txt_transform="uppercase" margin_bottom="0" font_family="none"]NEW RELEASES[/mk_fancy_title][ess_grid alias="Single-page-releases"][/vc_column][/mk_page_section] 

bu mümkün mü? Bunu yapmak için nasıl giderim?

Yardımlarınız için teşekkür ederiz.

cevap

0

Temanızın Sayfa şablonunu değiştirmek isterseniz, temalar/yourtheme/views/singular/wp-page.php dosyasında bulunan dosyaları düzenlemeniz gerekir.

Düzenlemeye çalıştığınız dosya, daha sonra global.php dosyasındaki bir işleve erişmek ve sayfa için belirli dosyaları yüklemek olacaktır.

B

Btw. mk_page_section bunu yapmak için bir işlev yazmak gerekir kendini oluştururken bir shortcode olup olmadığını

<?php echo do_shortcode("[SHORTCODE_EXAMPLE]"); ?> 
0

ile php kısa kod yürütebilirsiniz.

Kendi yaratıcınızı oluşturabilir ve Görsel besteci ile kendi kısa kodlarınızı da ekleyebilirsiniz. Google, kısa kodunuzu bir php sınıfı uzantısı kullanan VC'ye nasıl entegre edeceğinizi gösterir.

Her iki yol da, shortcode'unuzu add_shortcode işlevini kullanarak WordPress ile kaydetmeniz gerekir.

Örnek bir kısa koddur. İşlevlerinizde

. Bir kısa kod ekleyebilirsiniz.

add_shortcode('my-magic-shortcode','myCustomFunction'); 
function myCustomFunction($atts){ 
    global $post; 
    /// note these defaults can be overridden 
    $atts = shortcode_atts(
     array(
      'bg_color' => '#fff', 
      'attachment' => 'fixed', 
      'bg_position' => 'center top', 
      'bg_stretch' => 'contain', 
      ///// add more defaults 
     ), $atts, 'my-magic-shortcode'); 

    echo '<div style="background-color:'.$atts['bg_color'].';background-attachment:'.$atts['attachment'].';background-position:'.$atts['bg_position'].';background-stretch:'.$atts['bg_stretch'].';" >'.wpautop($post->post_content).'</div>'; 
    //// alternatively you could use a return to send all this back to a variable for use later in your page 
    //// just comment out the line that echos the string above 
    $str_html = '<div style="background-color:'.$atts['bg_color'].';background-attachment:'.$atts['attachment'].';background-position:'.$atts['bg_position'].';background-stretch:'.$atts['bg_stretch'].';" >'.wpautop($post->post_content).'</div>'; 
    return $str_html; 
} 
İlgili konular