How to prevent Widget from echoing to wrong position in DOM

dynamic_sidebar will output the sidebar when it is called. Try using it with buffering and store into a variable as below: <ul class=”menu”> <?php $locations = get_nav_menu_locations(); if ( isset( $locations[ ‘mega_menu’ ] ) ) { $menu = get_term( $locations[ ‘mega_menu’ ], ‘nav_menu’ ); if ( $items = wp_get_nav_menu_items( $menu->name ) ) { foreach ( … Read more

Code to add template to page

locate_template function searches your current theme’s folder for template name(s). If your templates are in a root folder of your theme, use: $template = locate_template( ‘member-content-template.php’ ); otherwise, precede the name of a template with subfolder’s name ( no slash in front ): $template = locate_template( ‘templates/member-content-template.php’ ); To load a template ( if found … Read more

Using external DB within wordpress

1) If all output will happen in that one template, I don’t see why you can’t do everything in the template. How it’s organized is really up to you. 2) If the table is in the WordPress database, it certainly simplifies things, you won’t have to create a connection to another database. 3) It’s up … Read more

Custom stylesheet not loading

Try using below code in your themes functions.php file: // custom login for theme function my_loginlcustomization() { echo ‘<link rel=”stylesheet” type=”text/css” href=”‘ . get_bloginfo(‘stylesheet_directory’) . ‘/login/login-styles.css” />’; } add_action(‘login_head’, ‘my_loginlcustomization’);

Search custom post type result in same template page

1.Create a single-(cpt).php in your theme, duplicate a your single.php and rename it as per your CPT name, so this page template will use to show your CPT queries. For more details refer the wordpress codex. https://codex.wordpress.org/Category_Templates To create CPT arcive page follow the same proceduare. archive-(cpt).php For Taxonimies taxonomy-(cpt).php CPT is your custom post … Read more