• Resolved Simply Seath

    (@foodcritic)


    Hey guys,

    I found this cute code for adding a custom note to where I need in admin area. The problem with it is, that it gives out a php waning :

    in_array() expects parameter 2 to be array, boolean given in…….

    I can’t for life of me figure how to fix it.

    add_action('admin_footer','print_mynote');
    function print_mynote(){
        global $typenow,$pagenow;
        if  (in_array( $pagenow, array( 'post.php', 'post-new.php' )  && "Post_Type_Name" == $typenow )) {
            ?>
            <SCRIPT TYPE="text/javascript">
                jQuery(document).ready(function(){
                    var myDiv = jQuery('<div>');
                    myDiv.css("border","1px dashed #000000");
                    myDiv.css("padding","5px");
                    myDiv.css("background","lightyellow");
                    myDiv.css("width","70%");
                    myDiv.html("PUT your info help message here....");
                    jQuery(".wrap").find("h2").after(myDiv);
                });
            </SCRIPT>
        <?php
        }
    }

    Any help would be appreciated ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The second parameter is a boolean. You have your parenthesis wrong.

    if  (in_array( $pagenow, array( 'post.php', 'post-new.php' )  && "Post_Type_Name" == $typenow )) ...

    Looka t it carefully. The second parameter is :

    array( 'post.php', 'post-new.php' )  && "Post_Type_Name" == $typenow

    , which is going to evaluate to true or false.

    That line needs to be :

    if  (in_array( $pagenow, array( 'post.php', 'post-new.php' ))  && "Post_Type_Name" == $typenow ) ...
    Thread Starter Simply Seath

    (@foodcritic)

    That did the trick, awesome!
    Thank you very much ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with custom note code.’ is closed to new replies.