jobmeer
Forum Replies Created
-
Forum: Hacks
In reply to: Change order of posts and exclude some postsFor more info on custom fields look at; https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/
Forum: Hacks
In reply to: Change order of posts and exclude some postsIs ‘Dato’ the right custom field name? it’s case sensitive!
You have to add also a array for filter the right category:
<?php if(have_posts()) : ?> <?php $loop = new WP_Query( array( 'posts_per_page' => 5, 'cat' => 22, 'meta_key' => 'Dato', 'orderby' => 'meta_value', 'order' => 'ASC') ); while ( $loop->have_posts() ) : $loop->the_post();?>
Also have a look at:
https://www.ads-software.com/support/topic/ordering-by-meta-key-value?replies=3Forum: Hacks
In reply to: Change order of posts and exclude some postsTry something like this
<?php if(have_posts()) : ?> <?php $loop = new WP_Query( array( 'posts_per_page' => 5, 'meta_key' => 'Dato', 'orderby' => 'meta_value', 'order' => 'ASC') ); while ( $loop->have_posts() ) : $loop->the_post();?>
Forum: Hacks
In reply to: Change order of posts and exclude some postsFor the order of the post basen on a custom field use
meta_key=CustomFieldName&orderby=meta_value
In your query.Forum: Fixing WordPress
In reply to: Author of post not working with custom post type@jamil Can you explain how you did it? I tried the solution from the link but it is still not working.
Forum: Fixing WordPress
In reply to: Paged loop over 2 columnsI have create a code that allow 2 loops and not duplicate the posts, but it is still not working for the next page (
$paged
). Here the code:<?php get_header(); ?> <?php get_sidebar(); ?> <?php /* Left Column -------------------------------------------------------------------*/?> <div id="left-column"> <?php if (have_posts()) : $count = 0; $saved_ids = array(); while (have_posts()) : the_post(); ?> <?php $count++; ?> <?php $saved_ids[] = get_the_ID(); ?> <?php if ($count <= 5) : { $saved_ids[] = get_the_ID();?> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php } endif; // End if ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> <?php posts_nav_link(); ?> </div> <?php /* Right Column -------------------------------------------------------------------*/?> <div id="right-column"> <?php if (have_posts()) : query_posts(array( 'post__not_in' => $saved_ids, )); while (have_posts()) : the_post(); ?> <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> </div> <?php get_footer(); ?>
Does anyone have a idea how to fixed the paged problem in this code?
Forum: Themes and Templates
In reply to: No theme preview (blanc page)Resolved after a day looking to my codes..! It’s not in the code. The theme map name existed of two separate words with a inter space. Deleting the inter space like ‘theme name’ to ‘themename’ resolved the problem.
@luxonski Works like a charm. Thanks. You saved my day…
Anyone?
Forum: Themes and Templates
In reply to: how to query custom post type on search resultsThanks michaelH for your response. This is working perfect. Thanks…
I created a different output for members and for the regular posts results:
<?php if (have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <?php if ($post->post_type == 'members') { //Add a custom value $place=get_post_custom_values('Name');echo $place[0]; }?> <?php if ($post->post_type == 'post') {?> <div id="titel_post"><h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3><small> <?php edit_post_link('Edit this entry »', '', ' '); ?> </small> <?php the_excerpt(); ?> </div> <?php }?>
Forum: Themes and Templates
In reply to: how to query custom post type on search resultsThanks for Reply. But it’s not that I want to change the look in .ccs but like to apply the loop two times.
One for all the search results of custom ‘member’ post and one for all the search results of regular post.
Normally on other pages I can query the loop with the above query code, but for search results this is not working. The query shows all the posts from custom ‘member’ post and not the search result.
Try
max-height: 1250px;
in your css. You can also set themin-height: 700px;
Forum: Fixing WordPress
In reply to: TinyMCE on Profile pageI have the tinyMCE editor working on the author “discription” field. But I added some costumfields with the register plus plugin. I copied the code:
if ( (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin/user-edit.php')) || (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin/profile.php'))) { add_action('admin_head', 'add_tinymce'); } remove_filter('pre_user_description', 'wp_filter_kses'); add_filter('pre_user_description', 'wpautop'); function add_tinymce() { if (function_exists('wp_tiny_mce')) { add_filter( 'teeny_mce_before_init', create_function( '$a', '$a["width"] = "440"; $a["height"] = "400"; $a["onpageload"] = ""; $a["mode"] = "exact"; $a["elements"] = "description"; $a["editor_selector"] = "mceEditor"; return $a;' ) ); wp_tiny_mce( true ); } }
Then renamed the “discription” element to my customfield name. That works fine. But I added more fields. I can’t get it working.
How can I add the tinyMCE editor to multiple customfields?