wp_get_attachment_image returns different image size

Handle built in sizes right I wrote a class that handles all the different stuff for built in image sizes. To redefine the built in sizes, use an extended class (the upper file in the linked source) To unset a class and skip it’s useage completely, just set w & h to 0. http://static.steffenvogel.de/wp-content/uploads/2011/07/octocat_construction.gif Click … Read more

Where to store some per-template preferences?

If the options have “visual” impact on the website, consider using the customizer, it gives immediate visual feedback on what changing a value means. If the settings have no visual impact on the website, then maybe they don’t belong in the theme after all, but in a separate plugin. There are always edge cases, so … Read more

How can I get wp_head() as a string instead of echoing it?

You can use PHP’s output buffering. WIth this you can write a wrapper for the get_head() function function wpse251841_wp_head() { ob_start(); wp_head(); return ob_get_clean(); } You can then use this as $data = array( ‘wpHead’ => wpse251841_wp_head(), ‘postContent’ => $post->post_content, ‘postContentFiltered’ => apply_filters( ‘the_content’, $post->post_content ) ); Reference: Output Control Functions

Get the php template file from other theme folder

You can filter the template with the template_include filter. This example will filter the archive template for all archive pages. If you need to do this for a specific archive, use is_post_type_archive( $post_types ) as your condition. Put this in your functions.php file of your child theme. function my_archive_filter( $template) { if ( is_archive() ) … Read more

Static Frontpage Pagination – Custom loop

Please, update your loop part with following code: <?php $page = (get_query_var(‘page’) ? get_query_var(‘page’) : 1); $args=array(‘post_type’ => ‘gadget’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 36, ‘page’ => $page); $wp_query = new WP_Query($args); if( $wp_query->have_posts() ) { $i = 0; while ($wp_query->have_posts()) : $wp_query->the_post(); $postidlt = $post->ID; Reason before using page instead of paged. page (int) … Read more

Loading template files from a subfolder in my theme?

That part is extremely rigid, see this question about loading page templates from plugin directory. With current state of related code I would not bother spending time on this. Especially since you want it for convenience (putting template in sub-directories) and not functionality (like loading from plugin folder).