Advertisement
hasanmisbah

wp-funnction-re-write

Oct 18th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.40 KB | None | 0 0
  1. // isn't working
  2. //add_action( 'tgmpa_register', 'colormag_register_required_plugins' );
  3.  
  4.  if( !function_exists( 'colormag_register_required_plugins' )):
  5.     function colormag_register_required_plugins() {
  6.  
  7.         /**
  8.          * Array of plugin arrays. Required keys are name and slug.
  9.          */
  10.         $plugins = array(
  11.  
  12.             // Include ThemeGrill Demo Importer as recommended
  13.             array(
  14.                 'name'      => 'ThemeGrill Demo Importer',
  15.                 'slug'      => 'themegrill-demo-importer',
  16.                 'required'  => false,
  17.             ),
  18.             array(
  19.                 'name'      => 'Advance Custom Fields',
  20.                 'slug'      => 'advanced-custom-fields',
  21.                 'required'  => true,
  22.             ),
  23.  
  24.         );
  25.  
  26.         $config = array(
  27.             'id'           => 'colormag',              // Unique ID for hashing notices for multiple instances of TGMPA.
  28.             'default_path' => '',                      // Default absolute path to bundled plugins.
  29.             'menu'         => 'tgmpa-install-plugins', // Menu slug.
  30.             'has_notices'  => true,                    // Show admin notices or not.
  31.             'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
  32.             'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
  33.             'is_automatic' => false,                   // Automatically activate plugins after installation or not.
  34.             'message'      => '',                      // Message to output right before the plugins table.
  35.  
  36.             'strings'      => array(
  37.                 'page_title'                      => esc_html__( 'Install Required Plugins', 'colormag' ),
  38.                 'menu_title'                      => esc_html__( 'Install Plugins', 'colormag' ),
  39.                 /* translators: %s: plugin name. */
  40.                 'installing'                      => esc_html__( 'Installing Plugin: %s', 'colormag' ),
  41.                 /* translators: %s: plugin name. */
  42.                 'updating'                        => esc_html__( 'Updating Plugin: %s', 'colormag' ),
  43.                 'oops'                            => esc_html__( 'Something went wrong with the plugin API.', 'colormag' ),
  44.                 'notice_can_install_required'     => _n_noop(
  45.                     /* translators: 1: plugin name(s). */
  46.                     'This theme requires the following plugin: %1$s.',
  47.                     'This theme requires the following plugins: %1$s.',
  48.                     'colormag'
  49.                 ),
  50.                 'notice_can_install_recommended'  => _n_noop(
  51.                     /* translators: 1: plugin name(s). */
  52.                     'This theme recommends the following plugin: %1$s.',
  53.                     'This theme recommends the following plugins: %1$s.',
  54.                     'colormag'
  55.                 ),
  56.                 'notice_ask_to_update'            => _n_noop(
  57.                     /* translators: 1: plugin name(s). */
  58.                     'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
  59.                     'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
  60.                     'colormag'
  61.                 ),
  62.                 'notice_ask_to_update_maybe'      => _n_noop(
  63.                     /* translators: 1: plugin name(s). */
  64.                     'There is an update available for: %1$s.',
  65.                     'There are updates available for the following plugins: %1$s.',
  66.                     'colormag'
  67.                 ),
  68.                 'notice_can_activate_required'    => _n_noop(
  69.                     /* translators: 1: plugin name(s). */
  70.                     'The following required plugin is currently inactive: %1$s.',
  71.                     'The following required plugins are currently inactive: %1$s.',
  72.                     'colormag'
  73.                 ),
  74.                 'notice_can_activate_recommended' => _n_noop(
  75.                     /* translators: 1: plugin name(s). */
  76.                     'The following recommended plugin is currently inactive: %1$s.',
  77.                     'The following recommended plugins are currently inactive: %1$s.',
  78.                     'colormag'
  79.                 ),
  80.                 'install_link'                    => _n_noop(
  81.                     'Begin installing plugin',
  82.                     'Begin installing plugins',
  83.                     'colormag'
  84.                 ),
  85.                 'update_link'                     => _n_noop(
  86.                     'Begin updating plugin',
  87.                     'Begin updating plugins',
  88.                     'colormag'
  89.                 ),
  90.                 'activate_link'                   => _n_noop(
  91.                     'Begin activating plugin',
  92.                     'Begin activating plugins',
  93.                     'colormag'
  94.                 ),
  95.                 'return'                          => esc_html__( 'Return to Required Plugins Installer', 'colormag' ),
  96.                 'plugin_activated'                => esc_html__( 'Plugin activated successfully.', 'colormag' ),
  97.                 'activated_successfully'          => esc_html__( 'The following plugin was activated successfully:', 'colormag' ),
  98.                 /* translators: 1: plugin name. */
  99.                 'plugin_already_active'           => esc_html__( 'No action taken. Plugin %1$s was already active.', 'colormag' ),
  100.                 /* translators: 1: plugin name. */
  101.                 'plugin_needs_higher_version'     => esc_html__( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'colormag' ),
  102.                 /* translators: 1: dashboard link. */
  103.                 'complete'                        => esc_html__( 'All plugins installed and activated successfully. %1$s', 'colormag' ),
  104.                 'dismiss'                         => esc_html__( 'Dismiss this notice', 'colormag' ),
  105.                 'notice_cannot_install_activate'  => esc_html__( 'There are one or more required or recommended plugins to install, update or activate.', 'colormag' ),
  106.                 'contact_admin'                   => esc_html__( 'Please contact the administrator of this site for help.', 'colormag' ),
  107.  
  108.                 'nag_type'                        => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions.
  109.             ),
  110.  
  111.         );
  112.  
  113.         tgmpa( $plugins, $config );
  114.     }
  115. endif;
  116.  
  117.  
  118.  
  119.  
  120. // its working without error
  121. if(! function_exists( 'colormag_entry_meta' )){
  122.     function colormag_entry_meta() {
  123.        if ( 'post' == get_post_type() ) :
  124.         echo '<div class="below-entry-meta">';
  125.         ?>
  126.  
  127.           <?php
  128.           $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
  129.           if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
  130.              $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
  131.           }
  132.           $time_string = sprintf( $time_string,
  133.              esc_attr( get_the_date( 'c' ) ),
  134.              esc_html( get_the_date() ),
  135.              esc_attr( get_the_modified_date( 'c' ) ),
  136.              esc_html( get_the_modified_date() )
  137.           );
  138.         printf( __( '<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-calendar-o"></i> %3$s</a></span>', 'colormag' ),
  139.             esc_url( get_permalink() ),
  140.             esc_attr( get_the_time() ),
  141.             $time_string
  142.         ); ?>
  143.  
  144.           <span class="by-line"><span class="author vcard"><i class="fa fa-user"></i><a class="url fn n" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo get_the_author(); ?>"><?php echo esc_html( get_the_author() ); ?></a></span></span>
  145.  
  146.           <?php
  147.           if ( ! post_password_required() && comments_open() ) { ?>
  148.              <span class="comments"><?php comments_popup_link( __( '<i class="fa fa-comment"></i> 0 Comments', 'colormag' ), __( '<i class="fa fa-comment"></i> 1 Comment', 'colormag' ), __( '<i class="fa fa-comments"></i> % Comments', 'colormag' ) ); ?></span>
  149.           <?php }
  150.         $tags_list = get_the_tag_list( '<span class="tag-links"><i class="fa fa-tags"></i>', __( ', ', 'colormag' ), '</span>' );
  151.         if ( $tags_list ) echo $tags_list;
  152.  
  153.         edit_post_link( __( 'Edit', 'colormag' ), '<span class="edit-link"><i class="fa fa-edit"></i>', '</span>' );
  154.  
  155.         echo '</div>';
  156.        endif;
  157.     }
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement