Advertisement
Guest User

Untitled

a guest
May 24th, 2023
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.54 KB | Source Code | 0 0
  1. <?php
  2.  
  3. // ====================== Footer Editor ======================
  4.  
  5. function ds_footer_links_editor($wp_customize) {
  6.    
  7.     $wp_customize->add_panel( 'footer_links_option', array(
  8.         'priority'       => 30,
  9.         'capability'     => 'edit_theme_options',
  10.         'title'          => __('Edit Footer Links', 'footer_links_title'),
  11.         'description'    => __('Customize the login of your website.', 'footer_links_title'),
  12.     ));
  13.    
  14.     $wp_customize->add_section('ds_footer_links_section', array(
  15.         'priority' => 5,
  16.         'title' => __('Footer Links Editor', 'footer_links_title'),
  17.         'panel'  => 'footer_links_option',
  18.     ));
  19.     // Before Link One
  20.     $wp_customize->add_setting('ds_footer_links_before_link_one', array(
  21.         'default' => 'Designed By',
  22.         'type' => 'option',
  23.         'capability' => 'edit_theme_options',
  24.     ));
  25.  
  26.     $wp_customize->add_control('ds_footer_links_before_link_one', array(
  27.         'label' => __('Text Before First Link', 'footer_links_title'),
  28.         'section' => 'ds_footer_links_section',
  29.         'type' => 'option',
  30.         'priority' => 5,
  31.         'settings' => 'ds_footer_links_before_link_one',
  32.     ));
  33.     // Link One
  34.     $wp_customize->add_setting('ds_footer_links_link_one', array(
  35.         'default' => 'Elegant Themes',
  36.         'type' => 'option',
  37.         'capability' => 'edit_theme_options',
  38.     ));
  39.  
  40.     $wp_customize->add_control('ds_footer_links_link_one', array(
  41.         'label' => __('First Link Text', 'footer_links_title'),
  42.         'section' => 'ds_footer_links_section',
  43.         'type' => 'option',
  44.         'priority' => 10,
  45.         'settings' => 'ds_footer_links_link_one',
  46.     ));
  47.     // Link One URL
  48.     $wp_customize->add_setting('ds_footer_link_one_url', array(
  49.         'default' => '#',
  50.         'type' => 'option',
  51.         'capability' => 'edit_theme_options',
  52.     ));
  53.  
  54.     $wp_customize->add_control('ds_footer_link_one_url', array(
  55.         'label' => __('First Link URL', 'footer_links_title'),
  56.         'section' => 'ds_footer_links_section',
  57.         'type' => 'option',
  58.         'priority' => 15,
  59.         'settings' => 'ds_footer_link_one_url',
  60.     ));
  61. // Before Link Two
  62.     $wp_customize->add_setting('ds_footer_links_before_link_two', array(
  63.         'default' => 'Powered By',
  64.         'type' => 'option',
  65.         'capability' => 'edit_theme_options',
  66.     ));
  67.  
  68.     $wp_customize->add_control('ds_footer_links_before_link_two', array(
  69.         'label' => __('Text Before Second Link', 'footer_links_title'),
  70.         'section' => 'ds_footer_links_section',
  71.         'type' => 'option',
  72.         'priority' => 20,
  73.         'settings' => 'ds_footer_links_before_link_two',
  74.     ));
  75.     // Link Two
  76.     $wp_customize->add_setting('ds_footer_links_link_two', array(
  77.         'default' => 'WordPress',
  78.         'type' => 'option',
  79.         'capability' => 'edit_theme_options',
  80.     ));
  81.  
  82.     $wp_customize->add_control('ds_footer_links_link_two', array(
  83.         'label' => __('Second Link Text', 'footer_links_title'),
  84.         'section' => 'ds_footer_links_section',
  85.         'type' => 'option',
  86.         'priority' => 25,
  87.         'settings' => 'ds_footer_links_link_two',
  88.     ));
  89.     // Link Two URL
  90.     $wp_customize->add_setting('ds_footer_link_two_url', array(
  91.         'default' => '###',
  92.         'type' => 'option',
  93.         'capability' => 'edit_theme_options',
  94.     ));
  95.    
  96.     $wp_customize->add_control('ds_footer_link_two_url', array(
  97.         'label' => __('Second Link URL', 'footer_links_title'),
  98.         'section' => 'ds_footer_links_section',
  99.         'type' => 'option',
  100.         'priority' => 30,
  101.         'settings' => 'ds_footer_link_two_url',
  102.     ));
  103.     // Footer Divider  
  104.     $wp_customize->add_setting('ds_footer_link_divider', array(
  105.         'default' => '|',
  106.         'type' => 'option',
  107.         'capability' => 'edit_theme_options',
  108.     ));
  109.    
  110.     $wp_customize->add_control('ds_footer_link_divider', array(
  111.         'label' => __('Footer Link Divider', 'footer_links_title'),
  112.         'section' => 'ds_footer_links_section',
  113.         'type' => 'option',
  114.         'priority' => 35,
  115.         'settings' => 'ds_footer_link_divider',
  116.     ));
  117. }
  118.  
  119. add_action('customize_register', 'ds_footer_links_editor');
  120.  
  121. function ds_new_bottom_footer() {
  122.    
  123. $footer_one = get_option('ds_footer_links_before_link_one','Designed By');
  124. $footer_two = get_option('ds_footer_links_link_one','muks media');
  125. $footer_link_one = get_option('ds_footer_link_one_url','http://www.muks-media.de/');
  126. $footer_three = get_option('ds_footer_links_before_link_two','Nehmen Sie');
  127. $footer_four = get_option('ds_footer_links_link_two', 'Kontakt mit uns auf');
  128. $footer_link_two = get_option('ds_footer_link_two_url', 'http://www.muks-media.de/kontakt/');
  129. $footer_divider = get_option('ds_footer_link_divider','|');
  130.    
  131. ?>
  132.  
  133. <script type="text/javascript">
  134. jQuery(document).ready(function(){
  135. jQuery("#footer-info").text(' ');
  136. jQuery('<p id="footer-info"><?php if( !empty($footer_one)) : ?><?php echo $footer_one; ?><?php endif; ?> <a href="<?php if( !empty($footer_link_one)) : ?><?php echo $footer_link_one; ?><?php endif; ?>"><?php if( !empty($footer_two)) : ?><?php echo $footer_two; ?><?php endif; ?></a> <?php if( !empty($footer_divider)) : ?><?php echo $footer_divider; ?><?php endif; ?> <?php if( !empty($footer_three)) : ?><?php echo $footer_three; ?><?php endif; ?> <a href="<?php if( !empty($footer_link_two)) : ?><?php echo $footer_link_two; ?><?php endif; ?>"><?php if( !empty($footer_four)) : ?><?php echo $footer_four; ?><?php endif; ?></a></p>').insertAfter("#footer-info");
  137. };
  138. </script>
  139.  
  140. <?php
  141. }
  142.  
  143. add_action( 'wp_head', 'ds_new_bottom_footer' );
  144. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement