Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Current year
- *
- * Shortcode for inserting the current year into a post or page..
- *
- * This is a sample snippet. Feel free to use it, edit it, or remove it.
- */
- add_shortcode( 'code_snippets_export_4', function () {
- ob_start();
- ?>
- <?php echo date( 'Y' ); ?>
- <?php
- return ob_get_clean();
- } );
- /**
- * Metabox - Counselor Name Post Title [Counselor]
- */
- add_action( 'rwmb_frontend_after_save_post', 'update_bio_post_title');
- function update_bio_post_title( $object ) {
- $post_type = $object->post_type;
- if ( 'bio' == $post_type ){
- $post_id = $object->post_id;
- // Get the field value
- $my_meta = rwmb_meta( 'counselor_full_name', '', $post_id );
- // Get the post title
- $my_post_title = get_the_title( $post_id );
- // Prepare update post
- $post_slug = sanitize_title_with_dashes ($my_post_title,'','save');
- $post_slugsan = sanitize_title($my_meta);
- $my_post_title = array(
- 'ID' => $post_id,
- 'post_title' => $my_meta,
- 'post_name' => $post_slugsan,
- );
- wp_update_post( $my_post_title );}
- }
- /**
- * Metabox - Counselor Name Post Title [Coach]
- */
- add_action( 'rwmb_frontend_after_save_post', 'update_coach_bio_post_title');
- function update_coach_bio_post_title( $object ) {
- $post_type = $object->post_type;
- if ( 'coach-bio' == $post_type ){
- $post_id = $object->post_id;
- // Get the field value
- $my_meta = rwmb_meta( 'counselor_full_name', '', $post_id );
- // Get the post title
- $my_post_title = get_the_title( $post_id );
- // Prepare update post
- $post_slug = sanitize_title_with_dashes ($my_post_title,'','save');
- $post_slugsan = sanitize_title($my_meta);
- $my_post_title = array(
- 'ID' => $post_id,
- 'post_title' => $my_meta,
- 'post_name' => $post_slugsan,
- );
- wp_update_post( $my_post_title );}
- }
- /**
- * Metabox - Counselor Name Post Title [Integration]
- */
- add_action( 'rwmb_frontend_after_save_post', 'update_integration_bio_post_title');
- function update_integration_bio_post_title( $object ) {
- $post_type = $object->post_type;
- if ( 'integration-bio' == $post_type ){
- $post_id = $object->post_id;
- // Get the field value
- $my_meta = rwmb_meta( 'counselor_full_name', '', $post_id );
- // Get the post title
- $my_post_title = get_the_title( $post_id );
- // Prepare update post
- $post_slug = sanitize_title_with_dashes ($my_post_title,'','save');
- $post_slugsan = sanitize_title($my_meta);
- $my_post_title = array(
- 'ID' => $post_id,
- 'post_title' => $my_meta,
- 'post_name' => $post_slugsan,
- );
- wp_update_post( $my_post_title );}
- }
- /**
- * Remove Editor and Author from Squirrly
- */
- add_filter('sq_load_snippet', function(){
- if(current_user_can('editor')){
- return false;
- }
- if(current_user_can('author')){
- return false;
- }
- return true;
- });
- /**
- * Hide Author in Embeds
- */
- add_filter( 'oembed_response_data', 'disable_embeds_filter_oembed_response_data_' );
- function disable_embeds_filter_oembed_response_data_( $data ) {
- unset($data['author_url']);
- unset($data['author_name']);
- return $data;
- }
- /**
- * Oxygen Builder Password
- */
- if( function_exists('oxygen_vsb_register_condition') ) {
- global $oxy_condition_operators;
- oxygen_vsb_register_condition('Has Password', array('options'=>array('true', 'false'), 'custom'=>false), array('=='), 'has_password_callback', 'Post');
- function has_password_callback($value, $operator) {
- if( $value == "true" && post_password_required( get_the_ID() ) ) {
- return true;
- } else if( $value == "false" && !post_password_required( get_the_ID() ) ) {
- return true;
- } else {
- return false;
- }
- }
- }
- /**
- * WordPress Password Protection
- */
- add_shortcode( 'code_snippets_export_14', function () {
- ob_start();
- ?>
- <?php
- echo get_the_password_form();
- ?>
- <?php
- return ob_get_clean();
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement