I find I can't target (e.g., "hide on selected") using the "or target by URL" scheme.
I tried "hide on selected" from "category/books/*" but it doesn't hide from that category.
I find I can't target (e.g., "hide on selected") using the "or target by URL" scheme.
I tried "hide on selected" from "category/books/*" but it doesn't hide from that category.
I am having the same issue, did you find a resolution?
No, I haven't found a solution as yet with my WP 3.4.2 installation. I've tried every way of entering the path, but nothing works. It's a pity because if it wasn't for this bug it would be an extremely useful plugin.
If the "target by URL" ever did work, then you would have thought that the code could be brought up to date.
I made a little progress getting 'target by URL' to work, though it doesn't make sense:
To hide a widget on the "/relating/" page I used the string "relating".
Theory: Initial and final slashes need to be omitted when hiding by URL
I'm having the same issue - can't target by URL, with or without slashes. This is probably the one option I'd be using the most; if there's a fix I'd be grateful to hear it. Targeting by single page has worked temporarily for me, but I'd like to have more control.
@kelek - Your suggestion works! To hide a widget from my category "books" I type in the "or target by URL" box:
category/books
... without leading or trailing slashes - and the widget in question now does not show in that category!
I thought I'd tried every combination, but obviously I missed that one. Thanks!
I find you can also exclude further pages of the category by (e.g.):
category/books/page/2
I want to show on select urls. I'm not able to make that happen nor find specific directions. Do I want to check any of the boxes on the left?
I want to specify a specific page (not category or post)
This site was moved from a different server where the plugin was working. The widget is the text widget. The target url is the full path (not changed with the server move).
Any help is appreciated.
Never mind, after I saved several times it started working one by one. I did have to change from the full path to just the page and no slash.
Doesn't work no matter what combo I try. This would be really helpful if it worked. Do I need to set any category settings in addition to configuring the widget URL and such?
I put a little debug line into widget-context.php to echo $url; just before the return from function get_current_url()
On my local site it showed https://localhost/mypage
Not at all what I was expecting, but using that string gets a match on target by URL.
Better still...seems you can use the * wildcard anywhere on the URL.
e.g. */mypage/*
Hope that helps.
Make sure you don't have an empty carriage return in "or target by URL" field.
I found *category/mycategory* works
but any other varient doesnt' seem to work ie. /category/mycategory* or /category/mycategory/*
It seems like it works, but is a bit too picky (and the examples given in the plugin itself don't work)
It worked for me when i entered the page like this:
no checkbox clicked
url: xxx.com/some-name-of-page/
i used: */some-name-of-page
notice there is no end slash
I've found the solution that worked for me. To use this you have to first set the wordpress permalinks under 'Settings - Permalinks'. Use Custom Structure e.g. /%category%/%postname%/ which means your permalinks or URL (using an example of a category called 'events') will look like this:
Category index pages: http://abc.com/category/events/
Post pages: http://abc.com/events/public-stoning-on-monday/
Settings for this widget can thus be:
category/events (for the events index page)
events/* (for all pages under the category events)
Hope that helps.
Just Type in the page without any other markup like this ==>> mobile-website-design No / or any symbols.
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 http://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(); ?>as @visualeyes80 said, make sure that you don't have a blank line after your URLs in the show URL box!
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 http://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(); ?>weird thing, I been trying to make it work and searched for different solutions.
Finally fixed it work but changing some code in widget-context.php -
Found on http://wordpress.org/support/topic/plugin-widget-context, post by jpmorganjr:
In widget-context.php change this function:
function get_current_url() {
if ($_SERVER['REQUEST_URI'] == '')
$uri = $_SERVER['REDIRECT_URL'];
else
$uri = $_SERVER['REQUEST_URI'];
$url = (!empty($_SERVER['HTTPS']))
? "http://".$_SERVER['SERVER_NAME'].$uri
: "http://".$_SERVER['SERVER_NAME'].$uri;
if (substr($url, -1) == '/')
$url = substr($url, 0, -1);
return $url;
}
To this one:
function get_current_url() {
$uri = $_SERVER['REQUEST_URI'];
if (substr($uri, -1) == '/') $uri = substr($uri, 0, -1);
return $uri;
}
You won't be able to use the http or https versions of the target by URL anymore, but you shouldn't be able to anyway because all the widgets are on the same domain.
If I had more time I'd do a proper debug, but I'm in a hurry and wanted to share this because it's the only plugin that offers this solution and I know plenty of others need it to work!!
Then had to type */pagename (with the star before trailing slash) and it works :)
btw, big thanks to @jpmorganjr :)
So what is really working if I need to insert the URL of pages I want to hide/show a widget on?
It is a bit confusing, and disappointing. I have updated the plugin thinking it would have worked, but it actually does not.
it 's one of the best plugins ever and probably the most useful one, but now it is actually absolutely useless, because I can not set up the widgets to show on different pages.
i tried url with / or without, no space after the url, nothing worked.
Any FINAL clear help ? or an update of the plugin maybe?
Hi,
I am trying to show widgets on specific URLs/tags. It works then stops working.
Is this an issue with WP 3.5.1? Is their a fix?
Thanks for the help.
You must log in to post.