WordPress.org

Ready to get started?Download WordPress

Forums

Posts in Sidebar
[resolved] Displaying plugin not in widget area (6 posts)

  1. astandera
    Member
    Posted 7 months ago #

    Dear sirs,
    thank you for the plugin. I am using it in a very simple way: 1 post, text only, one short sentence and I am looking for a help.

    My theme has a widget area in sidebar STARTING BELOW sidebar SECONDARY MENU, so unfortunately my post from the plugin can be shown BELOW that menu.

    And my question: IS ..there a way to show it ABOVE that menu? It is not widget area, but in sidebar. Any way using SHORTCODE or ... I am sad :-/

    Visually: There is a webcam picture in left sidebar and I need to show the text from the plugin just below it:
    http://www.skidestne.cz/

    http://wordpress.org/plugins/posts-in-sidebar/

  2. astandera
    Member
    Posted 7 months ago #

    SOLVED, hardcored :-) If you are interested, how to. I changed my theme a bit instead of changing the plugin, but easily, to get the plugin post to the right position in template, which was nonwidget area.

    1. Enabled PHP functionality to work from a plain Text/HTML widget, the guide is here and easy, no plugin reuired:
    http://www.emanueleferonato.com/2011/04/11/executing-php-inside-a-wordpress-widget-without-any-plugin/

    2. Cut PHP code of my Sidebar Menu hardcoded by the autor in nonwidget area :-( from the menu-secondary.php file in template folder and this code I Pasted into normal Text/Html widget (with the PHP code enabled in the point 1.).

    3. This TXT/HTML widget was dragged in the right order in Widgets.

    4. I was playing with plugin setup and my own CCS rules to format it.

    So that, i can have Posts in sidebar under my webcam here, top left blue rectangle with an icon. Icon is small pic 25 px of width enabled in plugin as Show Thubnails.

    http://www.skidestne.cz/

    Thanks to the author and community for keeping plugin alive it's very useful.

    Alois

  3. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Hi astandera,
    to display the Posts in Sidebar widget before that menu you have to edit the files of your current theme. I's a bad choice to do this because, if the theme is updated, you should re-add the modifications to the updated files. The good choice would be to create a child theme.

    Anyway, here's my solution. I downloaded your theme (Oxygen) and made the following changes.

    1. File functions.php

    Open the file functions.php and add these lines just before the ending PHP tag ?>:

    function pis_widgets_init() {
    	register_sidebar( array(
    		'name' => __( 'PIS Sidebar', 'oxygen' ),
    		'id' => 'sidebar-pis',
    		'description' => __( 'Appears in left sidebar, on top of the secondary menu.', 'oxygen' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    }
    add_action( 'widgets_init', 'pis_widgets_init' );

    Save the file.

    2. File menu-secondary.php

    Open the file menu-secondary.php and just before this line:

    if ( has_nav_menu( 'secondary' ) ) : ?>

    add these lines:

    if ( is_active_sidebar( 'sidebar-pis' ) ) : ?>
    	<div id="sidebar-pis" class="widget-area" role="complementary">
    		<?php dynamic_sidebar( 'sidebar-pis' ); ?>
    	</div><!-- #secondary -->
    <?php endif;

    Save the file.

    Now go to your widgets panel and you'll find a new sidebar, with the name PIS Sidebar. In this sidebar drag and drop a new Posts in Sidebar widget.

    Go to yous site and test the result.

    Hope this helps. Let me know.

  4. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Alois,
    while I was writing the reply, you were replying! :)

    I'm happy you solved so quickly!

    Bye.

  5. astandera
    Member
    Posted 7 months ago #

    Dear "Aldolat",
    thank you for taking an effort to help me. Your solution is also not "theme update resisted", BUT much more less dangerous and sophisticated, that mine is, so I will probably follow yours.

    It has to be a passion to keep the plugin alive, and also to help the others to replay their "how to" questions.

    I am repeating again: I appreciate your effort, the plugin is very useful.

    Thank you

  6. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Thank you for your kind words! :)

Reply

You must log in to post.

About this Plugin

About this Topic