This topic has 2 replies, 2 voices, and was last updated 8 years by Jonathan.

  • Author
  • #108816
     Jonathan
    Participant

    Hi there. I’m wondering if it’s possible to use a full-width row that could appear above the beginning of the sidebars. For example, I want to create a header like you see on this page http://www.ibogainealliance.org/members on this and other pages http://www.ibogainealliance.org/guidelines . The second page is built on a 3 column, left and right, sidebar setting, but I want a full width, full height element similar to the first page on top.

    #108862
     rikbutterflyskull
    Participant

    You can use the Header Content metabox at bottom of page edit. Put your shortcode or html content there. For shorcodes you can build your content with Visual Composer (VC) in page edit, switch to Classic Mode, copy and paste the raw text, or use exiting shortcodes.

    For page without editing permission like BuddyPress Page you must use a php function. I write for me three functions:

    COPY CODE
    add_action('kleo_before_content','add_bpgroup_head');
    function add_bpgroup_head() {
        if (is_page( 61 )) {
            echo do_shortcode('[shortcode]');
        }
    }
    add_action('kleo_before_content','add_bpactivity_head');
    function add_bpactivity_head() {
        if (is_page( 6 )) {
            echo do_shortcode('[shortcode]');
        }
    }
    add_action('kleo_before_content','add_bpmember_head');
    function add_bpmember_head() {
        if (is_page( 7 )) {
            echo do_shortcode('[shortcode]');
        }
    }

    where 61,6,7 are the Group, Activity and Members page ID, created by BuddyPress. Set your ids. Replace [shorcode] with your shortcode like rev slider shortcode, VC single image. These functions accept only simple shortcodes, not an entire VC page. (example 01 screenshot, a single image in header)

    To set a full row with content like entire page structure you must use:

    COPY CODE
    add_action('kleo_before_content','bp_custom_content_header');
     function bp_custom_content_header() {
    
      $pageid = 1024; //Page ID
      
      $id_page = get_post($pageid);
      
      $content = $id_page->post_content;
      $content = apply_filters('the_content', $content);
      $content = str_replace(']]>', ']]>', $content);
    
        if (is_page( 61 )) {
          echo $content;
        }
    }

    where $pageid is the page to show and 61 is still my members page ID (example 02a/b screenshot).

    Attachments:
    You must be logged in to view attached files.
    #108871
     Jonathan
    Participant

    That was super easy. Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?