Corneliatt
Forum Replies Created
-
Forum: Plugins
In reply to: Get the_title(); in a WP_QueryOh, I thought I had solve this, but now it doesn’t work. When I use “>” or something like that in the title it won’t find anything (of course, because the slug doesn’t contain >). Can I somehow strip the the_title() from >??
Thank you in advance!
Forum: Plugins
In reply to: Get the_title(); in a WP_QueryOk, so I managed to solve this. If someone has the same problem, I solved it by using get_the_title() instead of the_title().
🙂
Forum: Fixing WordPress
In reply to: Custom post types taxonomyHi and thanks for your answer. Can’t move this, so I guess I have to stay here 😉
I got it to work tho.. but with one problem solved, I found a new one… And this one is really basic, so I think it fits here 😉I have got a query that looks like this:
$new_query = new WP_Query(array('faq' => 'question', 'post_type' => 'question_faq', 'orderby' => 'rand', 'showposts' => '1'));This works perfectly. But it doesn’t work if I change ‘question’ to the variable $title like this:
$title = the_title(); echo $title; $new_query = new WP_Query(array('faq' => $title, 'post_type' => 'question_faq', 'orderby' => 'rand', 'showposts' => '1'));In the echo just before the query the $title is echoed just perfectly, but as soon as it gets into the query it somehow looses its value.
Does anyone know why is this?
Forum: Plugins
In reply to: WordPress jQuery Parallax = not workingps. Here you can see a demo of how it’s supposed to work (and how it worked before I started to implement it in wordpress…)
82hostel.com/demo/Forum: Fixing WordPress
In reply to: Exclude certain category in next_post_linkOk, so I found a plugin that solves this without any hacking. It’s called Ambrosite Next/Previous Post Link Plus and using this I just added:
<?php previous_post_link_plus( array('order_by' => 'post_date', 'format' => '%link', 'link' => '<span class="paddy">»</span>', 'in_same_cat' => true, 'ex_cats' => '5', 'ex_cats_method' => 'strong') ); ?>and problem solved!! 🙂 Thanks for your help!
Forum: Fixing WordPress
In reply to: Exclude certain category in next_post_linkNo, doesn’t work :/ It would had been too easy I guess :S
Have been searching the web for a looong time now without success. It’s kind of weird that it doesn’t seem to be any solutions on this problem out there. There must be a whole bunch of people wanting to do the same as me!So, back to your suggestion on category_not_in.. Where do I change the main query for single pages? I just seem to find queries for category pages and so on…
Forum: Fixing WordPress
In reply to: Exclude certain category in next_post_linkHi!
After some searching I found this script:
(functions.php)function prev_next_dont_include( $ids ) { foreach ( get_categories() as $category ) : // loop thru all WP cats if ( !in_array( $category->cat_ID, $ids ) ) : // check if cat id is in $ids $categories[] = $category->cat_ID; // build list of real excluded ids endif; endforeach; return implode( ' and ', $categories ); // "1 and 2 and 5 and 7 and 16 and 23" }(loop-single.php)
<?php next_post_link('%link', '»', false, prev_next_dont_include(array(5))); ?>This script seem to do the opposite of what I want. When using this, the navigation is just between blog posts in category ‘5’..
Is there a way to edit this to make it exclude all categories except 5?
Would be so grateful if someone could please help me!
Forum: Fixing WordPress
In reply to: Exclude certain category in next_post_linkOk, so now I know for certain that it’s because the blog posts are connected to other categories as well. Is there a way to tell next-post-link to “don’t show the blog posts connected to this category, even though it’s also in another category”??
Forum: Fixing WordPress
In reply to: Can't get my jquery to work on this simple scriptI’m almost embarrased to tell you the error.
I was totally focused on the script and really thought it was something wrong there. But the error was due to spaces in my theme name on the server…..
Thanks to both of you for trying to solve this none existing jquery error!! >_<
Forum: Fixing WordPress
In reply to: Can't get my jquery to work on this simple scriptOhh for a moment I thought that could be the solution! But I can’t get it to work even with the document ready function. Could there be somehing else that keeps it from working?
Forum: Themes and Templates
In reply to: Page loop with one page with different templateOk, thanks for your help. I’ve solved it!
Ok, thanks for your help. I’ve solved it!
Forum: Themes and Templates
In reply to: Page loop with one page with different templateHi again!
Now everything is how it should be, except for one “small” thing.
I want to sort the blog posts after a custom date picker field. I found this script which should do exactly what I want.In functions:
// CREATE UNIX TIME STAMP FROM DATE PICKER function custom_unixtimesamp ( $post_id ) { if ( get_post_type( $post_id ) == 'events' ) { $startdate = get_post_meta($post_id, 'startdate', true); if($startdate) { $dateparts = explode('-', $startdate); $newdate1 = strtotime(date('Ymd', strtotime($dateparts[1].'/'.$dateparts[2].'/'.$dateparts[0]))); update_post_meta($post_id, 'unixstartdate', $newdate1 ); } } } add_action( 'save_post', 'custom_unixtimesamp', 100, 2);In the loop:
<?php $title = get_the_title(); if ($title == 'Upcoming') { $today = time(); $args = array( 'category_name' => 'events', 'posts_per_page' => 5, 'meta_query' => array( array( 'key' => 'unixstartdate', 'compare' => '>=', 'value' => $today, ) ), 'meta_key' => 'startdate', 'orderby' => 'meta_value', 'order' => 'ASC', ); $post_query = new WP_Query( $args ); // The Loop if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <h2> <span class="ingress"><?php echo date('d F', custom_unixtimestamp($startdate )); ?></span><br /> <?php the_title(); ?></h2> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('medium'); }?> <p><?php the_content(); ?></p> </li> <?php endwhile; endif; } ?>But I can’t get it to work.
First of all, the script doesn’t seem to catch the dates (1 january 1970 on all the posts) and well.. I guess that’s also why it doesn’t sort it correctly. Could anyone please help me out on this one? 🙂Forum: Themes and Templates
In reply to: Page loop with one page with different templateOk! So now I’m using the wp_query query instead and the pages shows up just as before. But to be honest I’ve been reading through the page alchymyth sent me without being able to understand how the heck I can implement the second loop into it. And also, how I can manage to sort the output :S Would be awesome if you could try to explain in a newbie kind of way 🙂
Thanks!
Forum: Themes and Templates
In reply to: Page loop with one page with different templateHi there!
The thing is, there’s not much more to show.. here’s the code for loop.php:<?php $pages = get_pages('sort_column=menu_order'); foreach ($pages as $page_data) { $content = apply_filters('the_content', $page_data->post_content); $title = $page_data->post_title; ?> <div class="section"> <h1><?php echo $title; ?></h1> <span class="ingress"><?php the_field('ingress'); ?></span> <div class="entry-content"> <?php echo $content; ?> <ul> <?php // The Query query_posts( array ( 'category_name' => $title, 'posts_per_page' => -1 ) ); // The Loop if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('medium'); }?> <h2><?php the_field('date'); ?>, <?php the_title(); ?></h2> <p><?php the_content(); ?></p> </li> <?php endwhile; endif; ?> </ul> </div><!-- .entry-content --> </div> <?php } ?>Btw. Just realized I have to do something about the the_field “ingress” because it isn’t going through the page_data as the title and content. How do I manage to do this? Could this be part of the problem?