How can I use custom menus with a Bootstrap WordPress theme?

You can change the classes of the <ul> by adding ‘menu_class’=>’nav navbar-nav’ to your $args array. Remember, this parameter overwrites all the classes, so add “menu” as well if you want many themes and plugins to work! If you don’t want the outer <div>, you can “unwrap” the <ul> by adding ‘container’=>false. $args = array( … Read more

File Uploader – Upload without adding to Media Library

HTML Okay, you’ll of course want to set up an HTML file. I would use this code or something like it: <form action=”upload.php” method=”post” enctype=”multipart/form-data”> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload Image” name=”submit”> </form> Of course, you don’t have to use upload.php as your filename, that’s just what w3schools used. … Read more

Calling PHP Titles inside Javascript Markup

First, don’t echo your php, but assemble everything in a string, let’s say $titlestring. Next, make this string available for access by the javascript (the slug is the one you used to register the script): $params = array ( ‘titlestring’ => $titlestring, ); wp_localize_script (‘your-script-slug’, ‘IframeTitle’, $params); Finally, access the variable in the script: ‘<div … Read more

Need help removing […] after excerpt

This has to work, Im using it in several projects: add_filter( ‘excerpt_more’, ‘my_excerpt_more’ ); function my_excerpt_more( $more ) { return ”; } Just copy-paste it to your functions.php. Little bonus snippet that you might need: add_filter( ‘excerpt_length’, ‘my_excerpt_length’ ); function my_excerpt_length( $length ) { return 50; } This means that excerpt is 50 words long. … Read more

Meta Tag “description”

Do not add meta tags in post editor. Best way to do is use SEO plugins. Best plugin for SEO is Yoast Seo Or add this code in your themes header.php just after title tag. <meta name=”description” content=”<?php if ( is_single() ) { single_post_title(”, true); } else { bloginfo(‘name’); echo ” – “; bloginfo(‘description’); } … Read more

Website completely messes up when logging out

If you check out the browser’s console, you can see that several stylesheets are not loading. Also, there’s this error: Resource interpreted as Stylesheet but transferred with MIME type text/html: “https://www.counterboosting.com/wp-content/cache/minify/000000/M9BPLCjIz8wryU3NK9EvLqnMSQUA.css“. It appears that you have a plugin installed that does caching/script minification, and something is not configured correctly there. The plugin is probably configured … Read more

Converting a static HTML template into a WP theme – How do I specify page content?

So, this is how it works: Create HTML template. Add sample content to your template(from page backend) while converting HTML to WP theme. Ater finalising your WP theme, export all the WordPress backend content (sample data from WP backend) into the XML file and provide that XML files to your client if they want to … Read more

and tag not working

the_permalink() and the_post_thumbnail() echo their output. Use the “get_* version of those functions, get_the_permalink() and get_the_post_thumbnail() when concatenating a string to be output. Both the_post_thumbnail() and get_the_post_thumbnail() will echo/return <img> tags so don’t wrap their output in an <img> tag because it’s already taken care of by those functions. The original HTML posted is missing … Read more

Include HTML (Bootstrap Modal Box) with a plugin into my header

You only need the_content filter to add the modal, but bootstrap.js is needed to make it work. add_action(‘wp_enqueue_scripts’, array($this, ‘enqueue_bootstrap’); public function enqueue_bootstrap(){ wp_register_script( ‘bootstrap’, plugins_url( ‘your-plugin/assets/js/bootstrap.min.js’ ) ); wp_enqueue_script( ‘bootstrap’ ); } EDIT: You need to add $content argument to your function. As the codex says Note that the filter function must return the … Read more

How to place copyright next to footer menu?

You can achieve this by enclosing them in divs like in following line of your code <p id=”copyright”>&copy; <?php echo date(‘Y’);?> <?php bloginfo(‘name’); ?> | <?wp_nav_menu( array( ‘theme_location’ => ‘new-menu’, ‘container_class’ => ‘secondary-footer’ ) ); ?></p> Enclose above code in divs like this <div style=”float:left;width:50%;”><p id=”copyright”>&copy; <?php echo date(‘Y’);?> <?php bloginfo(‘name’); ?> | </div> <div … Read more