Support

Account

Forum Replies Created

  • for example you may try something like this in your functions.php

    add_action('get_sidebar', 'special_sidebar');
    
    function special_sidebar($sidebar) {
      $new_side_bar = get_field('ACFSideBarField');
      if ($new_side_bar) {
        return $new_side_bar;
      }
      return $sidebar;
    }
    

    it will change the $name in get_sidebar($name)

  • 
    function searchForName($name, $array) {
       foreach ($array as $key => $val) {
           if ($val['nickname'] === $name) {
               return true;
           }
       }
       return null;
    }
    $current_user = wp_get_current_user();
    if(searchForName($current_user->user_login,get_field('YourACFUserField'))):
    	//CODE GOES HERE
    endif;
    

    something like that

  • or my favorite way… clien-side scripts =)

    
    function stat_box(){
    	if (get_post_type()=='YourPostTypeSlug'){
    		$out = '<script type="text/javascript">';
    		$out .= 'var myMessage = jQuery(\'.field_type-message:contains("[stat_message_anchor]")\');if (myMessage) myMessage.html(myMessage.html().replace("[stat_message_anchor]","Lorem ipsum goes here..."))'; //changing content
    		$out .=  '</script>';
    		echo $out;
    	}
    }
    
    add_action('in_admin_footer', 'stat_box');
    

    and just put the text “[stat_message_anchor]” in your message

  • Why so complicated, are you really need this ‘Message’ field?

    function stat_meta_box( $post_type, $post ) {
    		add_meta_box(
    			'stat_box',
    			'Summary',
    			function(){global $post;var_dump($post);}, // just for example
    			array( ), // blank or list of your post_types
    			'advanced' // or 'side'
    		);
    }
    
    add_action( 'add_meta_boxes', 'stat_meta_box', 10, 2 );

    no extra queries or function chains but the same result

  • function remove_acf(){
      remove_menu_page( 'edit.php?post_type=acf' ); 
    }
    add_action( 'admin_menu', 'remove_acf',100 );

    I made this way…

    add_filter('acf/settings/show_admin', '__return_false')

    really not working

Viewing 6 posts - 76 through 81 (of 81 total)