Klimseven
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Post Type permalink not working on new postsThanks for your reply.
This didn’t work for me. I flushed the permalinks too. If I use the url ‘https://www.site-name.com/venue/venue-name’ it rewrites it to be ‘https://www.site-name.com/venues/venue-name’.
This is all particularly strange because all of my old venue posts are showing perfectly. It’s only any new posts that show up blank. It’s infuriating and I’m not sure what to try at this stage.
Forum: Fixing WordPress
In reply to: Custom Post Type permalink not working on new postsI’d really appreciate any help with this at all. I’ve posted it in numerous places but can’t get anyone to reply. I’ve looked at this for weeks with no luck.
Anything?
Forum: Fixing WordPress
In reply to: orderby custom post type by date field not workingPerfect. Thanks for your help!
Forum: Fixing WordPress
In reply to: orderby custom post type by date field not workingThanks for your reply. So if I have this order in the database, how can I make the outputted date more user friendly?
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldFigured out how to have it only display posts after the current time. Thanks for your help, I really appreciate it!
Final code:
<dl id="sportlist"> <?php $the_query = new WP_Query( array( 'post_type' => 'match', 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => 'date_field' ) ); $current_header = ''; while ( $the_query->have_posts() ) : $the_query->the_post(); # get the datum for this post $temp_date = get_post_meta( get_the_ID(), 'date_field', true ); # If they aren't the same, we'll start a new group, which for now # just means setting a new heading if (strtotime($temp_date) > strtotime('now')){ if ( $temp_date != $current_header ) { $current_header = $temp_date; echo "<dt>$current_header</dt>"; }?> <dd><?php the_title();?></dd> <?php } endwhile; wp_reset_query();?> </dl>
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldPerfect! Thank you.
Is there any way to have it so it only displays posts after the current date?
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldThanks a lot for your help.
I’ve managed to get my code working, so that it orders the posts by the custom date field. But it’s displaying the date for every title, even if they’re on the same date. I need to find a way to group events on the same day under one date. Hopefully this isn’t much more complex.
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldI presumed this was where the date field was being added in my backend code:
//Add fields to your meta box $my_meta->addDate($prefix.'when',array('name'=> 'When is the match ')); $my_meta->Finish();
I’ve a feeling I’m making this far more complicated than it ought to be.
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldFront end. Just a simple event list with dates and titles. Am I going about it the wrong way?
I’ve tried to pull the posts with a query, using your code above and replacing ‘date-field’ with ‘when’ as I think that’s the custom field name as far as I can tell. But no dice. (It shows the posts without this by the way, but just ordered normally, by post date.)
Forum: Fixing WordPress
In reply to: Order custom post type by date field*naturally the url in the code above isn’t actually ‘/home/urlblahblah.php’, just changed it for security reasons.
Forum: Fixing WordPress
In reply to: Order custom post type by date fieldThanks for the response.
So where you’ve put ‘date-field’ I need to include the custom field name? I’ve tried this but nothing is showing.
Here’s the code I’m using for the custom post type, it’s using the my-meta-box plugin for the date field (seen here) so I’m unsure how to call this as you have above:
//register your custom post type match add_action( 'init', 'register_cpt_match' ); function register_cpt_match() { $labels = array( 'name' => _x( 'Matches', 'Match' ), 'singular_name' => _x( 'match', 'match' ), 'add_new' => _x( 'Add New', 'match' ), 'add_new_item' => _x( 'Add New Match', 'match' ), 'edit_item' => _x( 'Edit match', 'match' ), 'new_item' => _x( 'New match', 'match' ), 'view_item' => _x( 'View match', 'match' ), 'search_items' => _x( 'Search match', 'match' ), 'not_found' => _x( 'No Matches found', 'match' ), 'not_found_in_trash' => _x( 'No Matches found in Trash', 'match' ), 'parent_item_colon' => _x( 'Parent match:', 'match' ), 'menu_name' => _x( 'Matches', 'match' ), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'just a simple "where, when, with who" kind of thing', 'supports' => array( 'title', 'custom-fields' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => 'https://i.imgur.com/4nTMD.png', 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'match', $args ); } if (is_admin()){ //include the main class file require_once("/home/urlblahblah.php"); $prefix = '_Matches'; //configure your meta box $config = array( 'id' => 'Matches-info', 'title' => 'Match Info', 'pages' => array('match'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false). ); $my_meta = new AT_Meta_Box($config); //Add fields to your meta box $my_meta->addDate($prefix.'when',array('name'=> 'When is the match ')); $my_meta->Finish(); }
Forum: Fixing WordPress
In reply to: WordPress keeps closing comments after I edit a postIt’s already checked.
Forum: Fixing WordPress
In reply to: Custom permalinks not workingThanks for your help.
I rang them and it turns out they use Zeus instead of Apache. So I applied the appropriate rules and the permalinks work, minus one – the homepage, which is returning an ‘Access denied’ error.
Any idea why this would be?
Forum: Fixing WordPress
In reply to: Display all posts but different html for each post typeThanks for the response.
Apologies, I said post type when I meant post format.
So, same question, but I just want to know what the loop code would look like with the conditional statements for post format instead of post types.
Right now I have the loop displaying posts from particular categories, so within the loop do I do this:
<?php if ( has_post_format('quote') ) { the_content(); // or whatever } ?>
Forum: Fixing WordPress
In reply to: TinyMCE won't format pasted content as 'Heading 1 (etc)'Yes. It’s really strange. It seems to be a problem with the content itself.
What I tried doing just now was pasting the text I just wrote above into the editor and editing that, and it worked without a problem.
The content I’m pasting in is just plain text, pasted from either TextEdit (as plain text) or Coda. I could paste it from the Word document I received it in but this is an even bigger headache as it comes with all of the formatting from that program and WordPress adds a lot of unnecessary divs and paragraphs, etc.
I never had a problem pasting plain text into TinyMCE before.