Give active class to current page on a while loop WP query for custom post types listing
Assuming you want to add the class to the li element. <li<?php echo get_queried_object_id() == get_the_ID() ? ‘ class=”active”‘ : ”;?>>
Assuming you want to add the class to the li element. <li<?php echo get_queried_object_id() == get_the_ID() ? ‘ class=”active”‘ : ”;?>>
How to save template data into wp_post table (post_content column)
Custom loops do not produce pagination like that. You have two options: Use custom archive page and provide custom php template for that (i.e. archive-my_name.php), in this custom template you could provide all other necessary content. Then you could use standard built-in pagination functions https://developer.wordpress.org/themes/functionality/pagination/ Continue in the direction you started, with single.php, but you … Read more
get full real path of thumbnail post img wordpress
I found the problem.. when creating the custom post type i set the argument “has_archive” to true and that was causing a conflict so my page-portfolio.php was not loaded. Also had to change the slug of the custom type field because it had the same slug as the page, so both of them were “portfolio”.
You can check for your post type single-{post-type}.php first try this: /* Define a constant path to our single template folder */ define(SINGLE_PATH, TEMPLATEPATH . ‘/single’); /* Filter the single_template with our custom function*/ add_filter(‘single_template’, ‘my_single_template’); /* Single template function which will choose our template*/ function my_single_template($single) { global $wp_query, $post; /* Checks for single … Read more
I would check the reading settings in the admin section (Settings->Reading). Make sure that the setting “Blog pages show at most” didn’t get changed. If that doesn’t fix it, try swapping back to the previous theme and see if it is anything to do with the theme’s loop. Otherwise, my last thought on it would … Read more
Is there a better way to do what I’m trying to do? Yes, use a mobile plugin or use your RSS feed to style a mobile version.
Install the Custom Post Template plugin and create different templates for your project pages. This works like page templates. You may also consider a custom post type for your projects to use different taxonomies, meta data and templates.
According to the documentation on that plugin, the capability to create custom fields is included.