• Resolved Robswaimea

    (@robswaimea)


    In a Metabox top right…..
    This adds Id’s to admin Event and Location Edit pages… a location link, and Cat Id to Event Edit Page.

    This adds respective Id’s on Locations and Event Add/Edit Pages.
    Event Id’s, Location Id’s to their Edit pages
    And also a link Location link on the Edit Event Page.
    And also a Category Id on the Edit Page.

    This will be adding Metaboxs to the top right of your Edit (Add) Event and Location Pages.

    Add these to you Theme functions.php file
    As always, make back ups of your files, preferably by FTP.

    I am using Theme Twenty Fourteen, latest version WP.
    I did’t get any php errors etc… this doesn’t change your database.
    and my apologies… but I can offer no specific coding help if it doesn’t work with your Theme.

    // ------------Adds Location Id in a Metabox Top of Edit Location Page-------
    
    function cf_post_id() {
        global $post;
    
       $EM_Locations = EM_Locations::get();
       $id = $post->_location_id;
     
       
      // Echo out the field
       echo '<input type="text" name="_id" value="' . $id . '" class="widefat" disabled />';
       echo  "[events_list recurrence=\"123\" limit=1]";
     
       
      }
    
     function ve_custom_meta_boxes() {
        add_meta_box('projects_refid', 'Location ID', 'cf_post_id', 'location', 'side', 'high');
    
       }
       add_action('add_meta_boxes', 've_custom_meta_boxes');
    
    // ------------Adds Category Id and Location Link of Event in a Metabox Top of Edit Event Page-------
    
    function cg_post_id() {
        global $post;
        global $EM_Event;
    
       // Get the data
       $id = $post->_event_id;
    
       // Echo out the field
       echo '<input type="text" name="_id" value="' . $id . '" class="widefat" disabled />';
       echo "<span style=\"font-weight:bold\">Category ID = </span>"; echo $EM_Event->output("#_CATEGORYID");
       echo "<br /><span style=\"font-weight:bold\">Location: </span>"; echo $EM_Event->output("#_LOCATIONLINK");
      }
    
     function vp_custom_meta_boxes() {
       add_meta_box('projects_refid', 'Event ID', 'cg_post_id', 'event', 'side', 'high');
      
       }
       add_action('add_meta_boxes', 'vp_custom_meta_boxes');
  • The topic ‘This adds Id’s to admin Event and Location Edit pages… and more…’ is closed to new replies.