Function Reference: geodir_add_page_content

Summary

Adds page content to the page.

Parameters

$position
(string) (required) Position to add the post content. ‘before’ or ‘after’.

Default: ‘before’
$gd_page
(string) (required) The geodirectory page type.

Default: null

Change Log

Since: 1.6.3

1.6.26 Listing description limit affects page description on add listing page – FIXED

Filters

‘geodir_add_page_content_position’ [Line: 3505]

Source File

geodir_add_page_content() is located in geodirectory_template_actions.php [Line: 3468]

Source Code

function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
    global $post;

    $gd_page_id = NULL;
    if ($gd_page == 'home-page' && geodir_is_page('home')) {
        $gd_page_id = geodir_home_page_id();
    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
        $gd_page_id = geodir_preview_page_id();
    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
        $gd_page_id = geodir_add_listing_page_id();
    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
        $gd_page_id = geodir_success_page_id();
    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
        $gd_page_id = geodir_location_page_id();
    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
        $gd_page_id = geodir_info_page_id();
    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
        $gd_page_id = geodir_login_page_id();
    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
        $gd_page_id = geodir_payment_checkout_page_id();
    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
        $gd_page_id = geodir_payment_invoices_page_id();
    }

    if (!$gd_page_id > 0) {
        return;
    }
    
    $display = 'before';
    /**
     * Filter the position to display the page content.
     *
     * @since 1.6.3
     *
     * @param string $display Position to add the post content.
     * @param string $gd_page The geodirectory page type.
     */
    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);

    if ($position !== $display) {
        return;
    }

    $gd_post = $post;
    $post = get_post($gd_page_id);

    setup_postdata($post);

    if (get_the_content()) {
        ?>