Follow us on

Codestar Support Forum » WordPress Plugins » Codestar Framework

Edit Post Link on Admin Submenu

  1. Is there a way within CSF that I can add a submenu that contains a link to the edit page for a custom post type? I currently have an Admin menu that contains 2 submenus created by CSF::createOptions() and CSF::createSection() twice (Settings and Leads). Instead of containing fields, I would like the second submenu (Leads) to a link to the Admin edit.php?post_type=my_custom_post_type. If I remove the second section and add the edit link submenu manually, the one remaining section doesn't display or edit the same as it does when there are multiple sections defined. I.e. I have multiple sections under the Settings section and they all show up as a single section with all options. There's no segregation by section. I'm kinda rambling. I hope this makes sense.

    Thanks in advance.

    Posted 1 year ago #
  2. BTW, I found a workaround. I added the following CSS to hide the links:

    a[href*='tab=leads'] { display: none !important; }CopyCopied!

    It's not ideal, but it looks and feels the way I want it to work.

    Posted 1 year ago #

  3. Codestar


    Uh, That's not possible according to the framework working principle. Maybe it can possible with css/js trick like yours. Btw, I wonder, how you do it (menu item) appears again when you use "display: none !important" ?

    Let me give some examples to you for inspire. ( I rough coded for copy-paste test. )

    // a[data-tab-id="TAB_ID_HERE"] selector type is more readable.
    function wes_admin_head_css() {
      echo '<style type="text/css">
          display: none !important;
    add_action( 'admin_head', 'wes_admin_head_css' );
    // change edit.php to edit.php?post_type=your_custom_post_type and also backup, csf-demo things.
    function wes_add_link_to_admin_submenu() {
      global $submenu;
      $submenu['edit.php'][] = array( 'Backup', 'manage_options', admin_url( 'admin.php' ).'?page=csf-demo#tab=backup' );
    add_action( 'admin_menu', 'wes_add_link_to_admin_submenu' );CopyCopied!

    For eg, above code adds a "Backup" link sub menu on "Posts" admin menu. And it appears when click to the link then again disappear when click another section tab.

    Regards, Codestar

    Posted 1 year ago #