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).

Child Theme: how to override variables?

I’m mobile, so this will be short. Use the after_setup_theme hook to add a function to set those variables. Declare them as global inside that function before setting them. Hope that helps. If anybody wants to add an example to this answer before I get home, feel free. 😉

Gravity Forms Custom Templates [closed]

You can change a bunch in one hit with the gform_address_types filter, like this: /** * customise the Address field labels * @param array $addressTypes * @return array */ add_filter(‘gform_address_types’, function ($addressTypes) { $addressTypes[‘international’][‘zip_label’] = ‘Postcode’; $addressTypes[‘international’][‘state_label’] = ‘State’; return $addressTypes; });

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)