search form leads to 404

Don’t submit directly to search.php. WordPress probably will not know what to do with that. You will have the same issue submitting directly to any theme file. WordPress should pick up on the s parameter and process the search correctly if you just leave out the action attribute like so: <form id=’searchform’ method=’get’> Untested, but … Read more

Change default upload images size for contributors

The default image size for inserting images is stored in the options table in image_default_size. You can change the default image size by updating the option: update_option( ‘image_default_size’, ‘large’ ); Role-dependent default image size To change the default image size for contributors only, you could hook into pre_option_[option] filter (which is fired directly after sanitizing … Read more

how to display a page before the home page

1) create one template page on your page-templates dir in landingpage.php with this code page-templates/landingpage.php <?php /** * Template Name: Landing page */ ?> <div id=”main-content” class=”main-content”> <div id=”primary” class=”content-area”> <div id=”content” class=”site-content” role=”main”> <?php // Start the Loop. while ( have_posts() ) : the_post(); the_content(); endwhile; ?> </div><!– #content –> </div><!– #primary –> </div><!– … Read more

current_page_item is missing inside wp_nav_menu

If you’re not actually using a custom nav menu, why are you not just outputting wp_page_menu() directly? Problem As-implemented, your walker will never be executed (or, more accurately, you can’t control whether or not it is executed), because you’re not passing ‘theme_location’ (correct usage) or ‘menu’ (sub-optimal usage) to the args array. Here’s how the … Read more

Entirely Different Functions.php per Page?

functions.php will load automatically for every page load, but you could certainly move most of the content of your current functions.php to other files and use functions.php itself as a primarily a kind of switch. Caveat: You may have to hook some of your switching functions to get access to certain data. For example, functions.php … Read more

the_widget() inside functions.php

The function the_widget() does not return any output it only echos it. If you want to save its output to a variable you need to use output buffering. ob_start(); the_widget(‘My_Custom_Widget’); $w = ob_get_contents(); ob_end_clean();

Linking Javascript in functions.php file

So this looks like you’re using a JS package manager, possibly Dustin Diaz’s ScriptJS? And I’m assuming you are storing all these files within your theme folder it would then be just a matter of linking to your script.min.js file via the wp_enqueue_script mechanism as follows: function wpse143251_enqueue_theme_scripts() { wp_enqueue_script( ‘dustindiaz-scriptjs’, get_template_directory_uri() . ‘/assets/components/plugins/ajaxify/script.min.js?v=v1.9.6&sv=v0.0.1’ ); … Read more