Direct to another external Wordpress page

Asked

Viewed 178 times

0

Colleagues.

I am trying to touch Wordpress and confess that I am taking a huge beating. I have to create one more item in the menu in the Wordpress manager ( wp-admin ) and I saw that I have to create, if I’m not mistaken, inside the functions.php file, but I’m not sure how to create. I have a model that was created by the previous colleague who did so:

/************ ALBUM REGISTER***********/

add_action('init', 'album_register');
register_taxonomy('album', 'album', array('hierarchical' => true, 'label' => 'Categorias de Album', 'query_var' => true, 'rewrite' => true));
function album_register() {

    $labels = array(
        'name' => _x('album', 'post type general name'),
        'singular_name' => _x('album', 'post type singular name'),
        'add_new' => _x('Adicionar Album', 'Vereador'),
        'add_new_item' => __('Adicionar Album'),
        'edit_item' => __('Editar Album'),
        'new_item' => __('Adicionar Album'),
        'view_item' => __('Visualizar Album'),
        'search_items' => __('Procurar Album'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        //'menu_icon' => get_stylesheet_directory_uri() . '/imagens/vereadores.png',
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail')
      );
    register_post_type( 'album' , $args );
}
/************ END ALBUM REGISTER***********/

How would I create an item called paychecks and direct to the paychecks page.php?

Thank you!

1 answer

0

If you want to create in the admin main menu just use something like this:

add_action( 'admin_menu', 'my_admin_menu' );

function my_admin_menu() {
    add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'myplugin/myplugin-admin-page.php', 'myplguin_admin_page', 'dashicons-tickets', 6  );
}
  • I put this code, but now all pages appear Fatal error: Call to Undefined Function add_menu_page() in /cmni.rj.Gov.br/www/wp-content/themes/website/functions.php on line 92 and I can’t edit functions.php. How would I fix it?

  • @Jose.Marcos this code is an example of functionality. It is of paramount importance that you have access to ftp for this change. It is also worth checking if this code works in your version of Wordpres and check if it has been placed in the right place.

  • I have access to FTP. How would I fix?

  • open the file and remove the code

  • Perfect Otto. I did it. Thank you. About your code, I’m sorry, I’m just a layman. The error you gave was in relation to this add_menu_page method().

  • @Jose.Marcos if you check in the wordpress Codex he day to use this way. http://codex.wordpress.org/Function_Reference/add_menu_page Are you using an updated version ? And also every code implementation test do in a part installation to not have these problems

  • WP is 3.3.2. This system already existed here in the company. The person implemented, but then left and we are struggling to move, because we do not know much WP.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.