• Resolved seojedi

    (@seojedi)


    Hey guys,

    I have a blog page with the regular post loop but as you guys know, whenever the post loop is inserted, the PHP ignores all other content on the page as well as the .php.

    I need to add static text above the blog posts on my blog page. Is there a certain PHP or way I can add to allow this? The text can be inserted from the edit page section or the back end, I don’t care, as long as I can add static page above the blog!

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • the PHP ignores all other content on the page as well as the .php.

    No – it doesn’t. You can still have content before or after the Loop. If this is your main posts page, then try adding your static content to your index.php template file before the Loop.

    Thread Starter seojedi

    (@seojedi)

    Added it to the Main Index. Works!!!

    Thank you so much!

    I’m trying to do this as well – add static text before new posts on my blog page (not my home page – which is set to a static page). Can you please explain where to add the static content to the index.php template file? You say ‘before the Loop’, but I’m clueless as to what that means. Here is my main index.php info – (I’d like to add a “blog title”) – am I even looking to do this in the proper php file?

    <?php
    /*
    Title : SMOF
    Description : Slightly Modified Options Framework
    Version : 1.4.0
    Author : Syamil MJ
    Author URI : https://aquagraphite.com
    License : WTFPL – https://sam.zoy.org/wtfpl/
    Credits : Thematic Options Panel – https://wptheming.com/2010/11/thematic-options-panel-v2/
    KIA Thematic Options Panel – https://github.com/helgatheviking/thematic-options-KIA
    Woo Themes – https://woothemes.com/
    Option Tree – https://www.ads-software.com/extend/plugins/option-tree/
    */

    /**
    * Definitions
    *
    * @since 1.4.0
    */
    $theme_version = ”;

    if( function_exists( ‘wp_get_theme’ ) ) {
    if( is_child_theme() ) {
    $temp_obj = wp_get_theme();
    $theme_obj = wp_get_theme( $temp_obj->get(‘Template’) );
    } else {
    $theme_obj = wp_get_theme();
    }

    $theme_version = $theme_obj->get(‘Version’);
    $theme_name = $theme_obj->get(‘Name’);
    $theme_uri = $theme_obj->get(‘ThemeURI’);
    $author_uri = $theme_obj->get(‘AuthorURI’);
    } else {
    $theme_data = get_theme_data( TEMPLATEPATH.’/style.css’ );
    $theme_version = $theme_data[‘Version’];
    $theme_name = $theme_data[‘Name’];
    $theme_uri = $theme_data[‘ThemeURI’];
    $author_uri = $theme_data[‘AuthorURI’];
    }

    define( ‘SMOF_VERSION’, ‘1.4.0’ );
    define( ‘ADMIN_PATH’, TEMPLATEPATH . ‘/admin/’ );
    define( ‘ADMIN_DIR’, get_template_directory_uri() . ‘/admin/’ );
    define( ‘LAYOUT_PATH’, ADMIN_PATH . ‘/layouts/’ );
    define( ‘THEMENAME’, ‘Theme Options’ );
    /* Theme version, uri, and the author uri are not completely necessary, but may be helpful in adding functionality */
    define( ‘THEMEVERSION’, $theme_version );
    define( ‘THEMEURI’, $theme_uri );
    define( ‘THEMEAUTHORURI’, $author_uri );

    define( ‘OPTIONS’, $theme_name.’_options’ );
    define( ‘BACKUPS’,$theme_name.’_backups’ );

    /**
    * Required action filters
    *
    * @uses add_action()
    *
    * @since 1.0.0
    */
    if (is_admin() && isset($_GET[‘activated’] ) && $pagenow == “themes.php” ) add_action(‘admin_head’,’of_option_setup’);
    add_action(‘admin_head’, ‘optionsframework_admin_message’);
    add_action(‘admin_init’,’optionsframework_admin_init’);
    add_action(‘admin_menu’, ‘optionsframework_add_admin’);
    add_action( ‘init’, ‘optionsframework_mlu_init’);

    /**
    * Required Files
    *
    * @since 1.0.0
    */
    require_once ( ADMIN_PATH . ‘functions/functions.load.php’ );
    require_once ( ADMIN_PATH . ‘classes/class.options_machine.php’ );

    /**
    * AJAX Saving Options
    *
    * @since 1.0.0
    */
    add_action(‘wp_ajax_of_ajax_post_action’, ‘of_ajax_callback’);

    ?>

    my site is here – https://www.deboradale.com and the page I’m trying to editwould be https://www.deboradale.com/blog

    Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add text above blog’ is closed to new replies.