Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thank for your help memelab – but there was no extra line after the URLs list, HOWEVER I did find a solution!!!!

    Google searched and discovered another Support Forum for a similar widget at https://themeshaper.com/forums/topic/widget-logic-problem-with-is_home-and-blog-versus-static-page where another user was trying to display context sensitive widgets on a static homepage (and additionally in my case a custom version of sidebar-page.php.)

    “lance1572” tried adding ‘<?php wp_reset_query(); ?>’ to the end of his query function and solved his problem

    I added the same code to the bottom of my query function and it worked!

    Just in case this helps someone else, here’s the revised code for my customed sidebar-page.php template:

    <?php
    /**
     * Template Name: Homepage Sidebar Template
     * Description: A Page Template that adds a sidebar to pages
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); 
    
    ?>
    
    		<div id="primary" style="margin: 0 -26.4% 0 0%; width: 74%; padding:0;float:left;display:inline;">
    
    			<div id="content" style="margin: 0%;" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'page' ); ?>
    
                        <?php
    					/* Lets see if we have a category to display */
    					global $post;
    
    					// Save our page posts to use later
    					$tmp_post = $post;
    					$catid = "";
    
    					// Do we have a category set on the custom fields
    					$meta_cat = get_post_meta($post->ID, 'category', true);
    
    					// Do we have an order set on the custom fields
    					$asc = get_post_meta($post->ID, 'asc', true);
    
    					// Do we want to display thumbnail and excerpts list?
    					$excerpt = get_post_meta($post->ID, 'list', true);
    
    					// Do not rely on what the admin entered
    					$order = $asc ? 'ASC' : 'DESC';
    					if( $meta_cat ) {
    						// If we have a meta value is it numeric or a slug, return an id
    						$catid = is_numeric( $meta_cat ) ? $meta_cat : get_cat_ID($meta_cat);
    					}
    
    					// No category ID so use the page slug to find a category
    					if( !$catid ) $catid = get_cat_ID($post->post_name);   
    
    					// If we have a category id we can get the category posts
    					if( $catid  && is_numeric( $catid ) ) {
    						$do_not_show_stickies = 1; // 0 to show stickies
    						$args = array(
    							'cat' => $catid,
    							'paged' => $paged,
    							'order' => $order,
    							'ignore_sticky_posts' => $do_not_show_stickies
    						);
    
    						$wp_query = null;
    						$wp_query = new WP_Query();
    						$wp_query->query( $args );
    
    						// Output our Query
    						if ( $wp_query->have_posts() ) :
    
    							twentyeleven_content_nav( 'nav-above' ); 
    
    							while ( $wp_query->have_posts() ) : 
    
    								$wp_query->the_post();
    								if( $excerpt ) :
    									get_template_part( 'content', 'excerpt' );
    								else :
    									get_template_part( 'content', get_post_format() );
    								endif;
    							endwhile;
    
    							twentyeleven_content_nav( 'nav-below');
    						endif;
    					}
    				?>
    
    				<?php
    					// Reset the post to the page post
    					$post = $tmp_post; 
    
    				?>
    
    					<?php comments_template( '', true ); ?>
    					<?php endwhile; // end of the loop. ?>
    					<?php wp_reset_query(); ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Hoping someone in this support stream can help. First off my PHP knowledge is minimal, so please keep that in mind when posting a possible solution.

    I posted my problem as a new thread – but have not received any suggestions in 4 days. I note the plugin author is very silent on responding to any posts for help – and yet solicits financial support!

    Anyhoo….

    My homepage is using a custom template that is based on the default SIDEBAR-PAGE.PHP template (WordPress 3.5). I included some query code within the content div of this template to enable me to post ONLY those posts to that page that I wanted. The query code was developed by someone else and I’ve used it without issue on other websites.

    However, I am unable to get Widget Context to display specific widgets on that custom template (which is my homepage!) other than a universal site widget called “Support”

    So somehow this plugin IS getting ONE widget to display but not the specific ones I want.

    I’ve tried all of the various suggestions above for targeting the page by URL, category, tag etc – NONE work.

    The page ID is “4”. I’m sure that if I could add a line to the “Check by tag settings section” (around line 324) telling the plugin to post to page 4 I could resolve the issue – but I don’t know enough PHP to do this and all my attempts at writing the code have either been completely ineffective or rendered a coding error so the page doesn’nt display at all.

    The homepage URL is actually https://www.stjosephmuseum.ca/page/4 and if you type that URL into browser’s address line the widgets DO show up – just NOT when you click on the “HOME” button.

    Any thoughts on how to resolve this? I would greately appreciate your help.

    Here’s the custom template code for my homepage as reference (modified SIDEBAR-PAGE.PHP template) – you’ll note it resets the post query – but…

    <?php
    /**
     * Template Name: Homepage Sidebar Template
     * Description: A Page Template that adds a sidebar to pages
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); ?>
    
    		<div id="primary" style="margin: 0 -26.4% 0 0%; width: 74%; padding:0;float:left;display:inline;">
    
    			<div id="content" style="margin: 0%;" role="main">
    
    				<?php the_post(); ?>
    
    					<?php get_template_part( 'content', 'page' ); ?>
    
                        <?php
    					/* Lets see if we have a category to display */
    					global $post;
    
    					// Save our page posts to use later
    					$tmp_post = $post;
    					$catid = "";
    
    					// Do we have a category set on the custom fields
    					$meta_cat = get_post_meta($post->ID, 'category', true);
    
    					// Do we have an order set on the custom fields
    					$asc = get_post_meta($post->ID, 'asc', true);
    
    					// Do we want to display thumbnail and excerpts list?
    					$excerpt = get_post_meta($post->ID, 'list', true);
    
    					// Do not rely on what the admin entered
    					$order = $asc ? 'ASC' : 'DESC';
    					if( $meta_cat ) {
    						// If we have a meta value is it numeric or a slug, return an id
    						$catid = is_numeric( $meta_cat ) ? $meta_cat : get_cat_ID($meta_cat);
    					}
    
    					// No category ID so use the page slug to find a category
    					if( !$catid ) $catid = get_cat_ID($post->post_name);   
    
    					// If we have a category id we can get the category posts
    					if( $catid  && is_numeric( $catid ) ) {
    						$do_not_show_stickies = 1; // 0 to show stickies
    						$args = array(
    							'cat' => $catid,
    							'paged' => $paged,
    							'order' => $order,
    							'ignore_sticky_posts' => $do_not_show_stickies
    						);
    
    						$wp_query = null;
    						$wp_query = new WP_Query();
    						$wp_query->query( $args );
    
    						// Output our Query
    						if ( $wp_query->have_posts() ) :
    
    							twentyeleven_content_nav( 'nav-above' ); 
    
    							while ( $wp_query->have_posts() ) : 
    
    								$wp_query->the_post();
    								if( $excerpt ) :
    									get_template_part( 'content', 'excerpt' );
    								else :
    									get_template_part( 'content', get_post_format() );
    								endif;
    							endwhile;
    
    							twentyeleven_content_nav( 'nav-below');
    						endif;
    					}
    				?>
    
    				<?php
    					// Reset the post to the page post
    					$post = $tmp_post; 
    
    				?>
    
    					<?php comments_template( '', true ); ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    Thread Starter sjmills93

    (@sjmills93)

    –JUST AS AN FYI TO ABOVE NOTED COMMENT ON VALIDATION–

    The 5 errors generated under the W3C validator are created by a plug-in The Events Calendar (https://www.ads-software.com/extend/plugins/the-events-calendar/) or at least the mix of the Events Calendar and the Custom Menu system.

    The Events Calendar plug-in uses DIV tags to identify and style data like “event”, “location” and “when” and thus these DIV tags end up underneath WordPress’s own UL and LI tags for widgets. This causes the W3C validator to identify the tree as having errors.

    I guess I’ll have to live without being able to completely validate this site or edit how the plug-in labels data.

    Thread Starter sjmills93

    (@sjmills93)

    OH MY!!!

    Yes Chase your clarification of the actual location of the JPG gave me the clue I needed to see my mistake of not having “header2.jpg” in the “headers” folder. I have corrected that.

    I have ensured the URL in the CSS is also pointing to the same place.

    Adeptris – I have also re-edited header.php to define the same location. The 126px was coming from the header file not the CSS – I’ve changed that now too.

    IT WORKS NOW!!!

    Thank you both so much. Always helps to have another set of eyes on this stuff. I’ve obviously been looking at this far too long to find the wood for the trees!

    Thank you. Displays perfectly now. Now, I just have to adapt the layout for IE6 & 7. Oh joy.

    Thread Starter sjmills93

    (@sjmills93)

    BTW – thanks for noticing the JPG was actually 125pixels in height. How I missed that I don’t know, anyhow I’ve changed the CSS heights accordingly.

    Thread Starter sjmills93

    (@sjmills93)

    Chase – are you suggesting that I turn off the “define” statement in the functions.php and just rely on the CSS to deliver the header2.jpg to the published screen?

    If so, I commented out the define header image in the functions.php file. Unfortunately, this is not resolving the issue.

    I’ve changed border to “none” only. Although the expression
    border: 0 none; is supposed to set the border width to “0” pixels (versus any other pixel width or “thin” or “medium” etc) and border style to “none” (versus solid, dashed etc). It’s a shorten way of writing border attributes.

    Thread Starter sjmills93

    (@sjmills93)

    Further….

    By defining an absolute URL in the child-theme functions.php file

    define( 'HEADER_IMAGE', 'https://www.paulciufo.com/wp-content/themes/paulciufo/images/headers/header2.jpg' );

    I have managed to ensure that output to page code now includes a complete and properly coded img tag.

    <img src="https://www.paulciufo.com/wp-content/themes/paulciufo/images/headers/header2.jpg" width="1000" height="126" alt="" />

    However, the white line and placeholder X is still not going away.

    Thread Starter sjmills93

    (@sjmills93)

    Chase thanks for taking the time to help with my problem.

    Here’s the output to page code for the IMG tag

    <img src="https://paulciufo.com/wp-content/themes/twentyten/images/headers/header2.jpg" width="1000" height="126" alt="" />

    I think there must have been some kind of syntax error in the functions.php file, because not it is outputting alt tag and closing img tag correctly.

    Unfortunately, this is not solving the problem.

    I note on the Tips page noted above that one of the responses to this tip from Bullion” stated the following:

    To use your shortcodes outside of posts, pages, and the text widget, you could always call your shortcode function directly like this:

    $text = yourShortCodeFunction(‘[your shortcode tag here]‘);
    echo $text;

    The above code will allow you to use wordpress shortcodes anywhere in your blog. Keep up the good work.

    However, I do not know enough about this syntax to figure out how I would adjust it for the contact form. I get where I’d put the short code but what would I put for “yourShortCodeFunction” and I’m assuming this would be pasted directly into the Sidebar.php file

    The weird thing is that I’m seeing the Stay Informed title in the sidebar with the short code, which is being displayed as a result of the Widget noted above (i.e.”add_filter” etc)

    Mike

    That didn’t work either. I used the last PHP code you gave me between the PHP tags.

    See a screen print in the MagicBlue theme.
    https://www.ellarebanks.ca/screenprint_contactform.pdf

    Also, the WordPress theme I used as a base is MagicBlue, although I’ve edited colours and font types

    Hmmm…..now the code at least does not display on the published page, but neither do the input fields (there are two – one for name and the other for email address).

    But I think we’re getting closer….

    Mike

    Sadly no this does not work.

    Hi Mike

    I’ve tried both methods and cannot get it to work. Website: https://www.ellarebanks.ca. Using WordPress 2.9.2 and wedget ready theme (modified for client).

    Here’s my functions.php file:

    <?php
    add_filter(‘widget_text’, ‘do_shortcode’);

    // Widgets
    if(function_exists(‘register_sidebar’)) {
    register_sidebar(array(
    ‘name’ => __(‘Sidebar’),

    ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ”,
    ‘before_title’ => ‘<h3>’,
    ‘after_title’ => ‘</h3>’,

    ));
    }
    ?>

    Here’s the code I entered from my sidebar.php file:

    <!– Fast and Secure Contact Form plugin begin –>
    <div style=”width:255px;margin-left:15px;margin-right:10px;border:0;color:#ffffff;”>
    [si-contact-form form=’2′]

    </div>
    <!– Fast and Secure Contact Form plugin end –>

    What am I missing?

Viewing 15 replies - 1 through 15 (of 15 total)