formica
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: php Sessions and last 5 page id'sGot it working by splitting the above code ie. placing the session in the ‘header.php’ then printing it where needed in the sidebar. From there you can use the post id’s to display what you need.
Thanks
Forum: Fixing WordPress
In reply to: Using cookies in querySorry was too hasty. For some reason the above won’t work without exploding the string see here
Correct code for putting a dynamic string in a query:
<?php $post_list = $_COOKIE['pages_visited']; ?> <?php query_posts( array('post__in' => explode(',', $post_list), 'post_type' => 'post_therapists') ); ?> <?php while ( have_posts() ) : the_post(); ?>
Thanks ixwa for posting.
Forum: Fixing WordPress
In reply to: Using cookies in queryDoh! Structured wrong. Codex
<?php $post_list = $_COOKIE['pages_visited']; ?> <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?> <?php query_posts( array('post__in' => array($post_list), 'orderby' => 'post__in', 'post_type' => 'post_therapists') ); ?> <?php while ( have_posts() ) : the_post(); ?>
[Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]
Forum: Fixing WordPress
In reply to: Website not found – login problemsNot sure what the ‘log in page site’ is but at the risk of being too obvious I can see your admin login here:
For what it’s worth I had a similar issue which was resolved by disabling plugins (maybe a javascript conflict). More specifically I had my blog in ‘maintenance mode’ – once disable it worked again.
Forum: Fixing WordPress
In reply to: Taxonomy 'get_the_term_list' redirectGenius! Thanks Husdaman. Much better than my solution.
Forum: Fixing WordPress
In reply to: Tax_Query and OrderbyWell… couldn’t figure out why it wasn’t working but got a work around from the codex..
global $query_string; query_posts( $query_string . '&order=ASC' );
No doubt something I was / am doing wrong.
Forum: Fixing WordPress
In reply to: Static Home Landings PageRename ‘page.php’ to ‘front-page.php’ in your themes files then create a new page in the admin area name it what you will and fix that as the static front page in ‘settings’ in admin.
Forum: Fixing WordPress
In reply to: Add viaraible to wp_list_categoriesNo worries got it working using ‘$id = get_the_title();’ then on the next page I’ll use a simple get_id and if, else to display different content. Quite static really, but works for what i need. final code:
function filter_categories($output, $args=array()) { $id = get_the_title(); return preg_replace('/(\<a\shref=\"?[^\>]+?)\"/', '$1?id='. $id .'"', $output); } add_filter('wp_list_categories', 'filter_categories', 10, 2);
Forum: Fixing WordPress
In reply to: Add viaraible to wp_list_categoriesAha! so got it working using a filter.
function filter_categories($output, $args=array()){ return preg_replace('/(\<a\shref=\"?[^\>]+?)\"/', '$1?area=map"', $output); } add_filter('wp_list_categories', 'filter_categories', 10, 2);
outputs: https://www.mysite.com/area/central/?id=map
Last hurdle. How do I get it to add that filter only from a certain page.
I need to get if is_page in there but it won’t work, probably due to my bad php.
Any pointers appreciated.
Thanks
Forum: Fixing WordPress
In reply to: Add viaraible to wp_list_categoriesHmm… I’m listing the taxonomies of a custom post type. So not sure it would work. Could you use preg_replace just to tack it onto the end?
Found this which adds an ‘id=xx’ to the ‘li’ but doesn’t alter the url.
function add_id_from_slug($wp_list_categories) { $pattern = '/class=/'; $replacement = 'id="xx" class='; return preg_replace($pattern, $replacement, $wp_list_categories); } add_filter('wp_list_categories','add_id_from_slug');
Do you know if it could be altered to add to the the url? Otherwise it’s the dreaded walker class for me.
Thanks.
Forum: Fixing WordPress
In reply to: Taxonomy 'get_the_term_list' redirectOoohh… it’s ugly and ‘technically’ doesn’t work but a preg_replace removes the taxonomy term in the url
$terms = get_the_term_list( $post->ID, 'therapies' ); $terms = preg_replace('/\btherapies\b/ie', ' ', $terms); // This will remove the word 'therapies' echo $terms;
It removes the word but leaves the forward slash. I’m thinking strip_tags may remove the slash?! but wordpress kindly removes it anyway, so it works for now.
If anyone knows a cleaner way of doing this please let me know.
Thanks
Forum: Fixing WordPress
In reply to: Multiple taxonomiesHoly Mother of God!
Even minus some caffeine you’re an unfettered genius!
I can’t thank you enough.
Thankyou thankyou and thankyou.
Forum: Fixing WordPress
In reply to: Multiple taxonomiesAw.. so close, I can see why it would work but it’s now displaying nothing. No errors all’s fine but just not outputting the name.
Forum: Fixing WordPress
In reply to: Multiple taxonomiesThanks. I can see that’s exactly what i need but unfortunately it throws up an error:
Parse error: syntax error, unexpected ‘=’, expecting ‘&’ or T_STRING or T_VARIABLE or ‘$’ in /../single.php on line 51