Home » WordPress (Page 3)

Category Archives: WordPress

WordPress/Google webtool error – missing author

While not a big problem you can simply insert this code snippet in a WordPress PHP file that suits. A good place is in your footer.php file where the message "Proudly powered by WordPress" lies. A text display of the WordPress websites author's name or perhaps a link to the author's profile

<span class='vcard author'>
<span class='fn'>
Site author <a href='https://web address of you profile if you wish">Fred etc</a>
</span>
</span>

How do I add a background image to WordPress’s Twenty Fourteen’s content area?

You should always create a child theme before modifying your sites CSS.

Aim: To achieve the results you can see on this page, in this case, a stainless steel background image on the content area.

Set the id #main to your background image then set the various classes areas making up the Twenty Fourteen content area to transparent allowing the background image to show through on your WordPress website page.

#main {    background-image:url('/img/yourimage.jpg');}

#main,
.site-content .entry-header,
.site-content .entry-content,
.site-content .entry-meta,
.page-content {
     background-color:transparent;
}

 

 

How do I make “no comments allowed” the default for all new WordPress webpages and posts

  • Go to the WordPress website’s Dashboard  menu option Settings
  • Choose  Discussion
  • Then uncheck or tick the box labelled  “Allow people to post comments on new articles”

    You can also hack the comment code in the PHP files such as single.php, page.php or anywhere it exists. A simple way to find the code  is to a search for the text that always appears with the comments. Searching all the PHP files can be achieved with your PHP editor if the facility exists, e.g. Microsoft WebMatrix.

Adding SEO to WordPress

Technical SEO’s meta tag components can be added to a WordPress website by installing a plug in like “Add Meta Tags” by George Notaras.  A short tutorial on adding WordPress plugins can be found here

 

The three technical component that matter most are

  • Title Tag
  • Description Tag
  • Keyword Tag

Page Title Tag : The <title></title> tags must describe the page accurately. Many engines use it to compose the site’s heading in their listing so include your primary keywords. It is the description used at the top of your browser window. It may also be used as the text label describing your page in a bookmark/favourite list. Use 6 to 12 words and keep it less than 64 characters in length. Try and repeat sensibly important keywords – “Cakes from the Cake Company.” “Cakes Cakes Cakes Cakes Cakes” will be treated as spam and ignored. Avoid ego titles – your or the company name for example. New customers are more likely to search for “car repair UK” than “Bloggs motors” The page title is
the most important SEO tool available.

The title for this page is “WordPress Training: Adding WordPress Plugins”

Description meta tag: use by some search engine listings to describe your website’s page. This may be what people read in the engines’  listings and thus can be used to tempt them to look and visit your site. Write one for each page – use at least one keywords near the beginning and up to 11 to 20ish words in total or 200 to 250 characters.

The Description for this page is “Basic WordPress Training Part 4 – adding useful WordPress Plugins.”

Keyword meta tag:  though not so important these days, but list your most important keywords or key word phrases for insertion into each of the pages. Important words first. Just repeating keywords or adding irrelevant words is not going to work. Use between 7 and 48 words.

e.g.:“performance car exhausts, car exhausts, performance exhausts, exhausts”

covers both keywords and keyword phrases.

The keywords for this page are “basic wordpress training”  and ” adding wordpress plugins”

Note that the keyword emphasied in this page’s tags  is “WordPress”

For a fuller account on general SEO techniques read these posts.

Display the width of your device’s screen in a WordPress Page

Simply insert this piece of JavaScript where you would like to see the width displayed. This is useful to test a devices resolution.

<div id="widthInfo">
</div>

<script>
    var x=screen.width;
    var para = document.createElement("P");
    var t = document.createTextNode(x);
    para.appendChild(t);
    document.getElementById("widthInfo").appendChild(para);
</script>

Using “document.write(screen.width)” is not going to work by the way.

Google says robots.txt ok, but description for this result is not available.

So you have set up your WordPress site along with a robots.txt and a Google web tools account.

Google says the robots.txt file says the website crawl is allowed

You try  looking at www.yoursite.co.uk/robots.txt etc and the file displays something like these, i.e. they are ok…

User-agent: *
Disallow:
User-agent: *
Disallow: /wp-admin/

Google happily crawls the site, but you get the entry

Your Title Text
www.yourwebsite.com/
A description for this result is not available because of this site's  robots.txt – learn more.

You click on that  robots.txt link and all is good… Hair pulling out time?

Time Lagging

With all below, remember… If you have made a change and tried your website again too quickly, caches may not update for sometime –  be patient before reindexing!

Usual Advice

Lots of Google searching tells you things like,

“WordPress creates its own robots.txt” and use  plugin to edit it like WP Robots Txt

Robots.txt Content

The content of your robots.txt file. Delete the above and save to restore the default.

Visibility

Have you checked this setting in the main menu SETTINGS/READING

Search Engine Visibility
Search Engine Visibility

It is up to search engines to honor this request.

If you have uncheck it, but it may take a little while for caches and Google to catch up. So wait a bit.

Google-sitemap-generator

 

Try adding the plugin: Google-sitemap-generator, delete any robots.txt files you have on the site. Then go back to Google Website Tools.

  1. Check out robots.txt is ok again, it should have added a sitemap detail.
  2. Ask for a crawl of the page that is problematical.

It may take sometime to have an effect…

 

 

WordPress, SEO and robots.txt

Robots.txt – file.

Robots.txt tells good search engines which pages are to be included and which to ignore and not index. For example the simple lines:

User-agent: *
Disallow: /

In a text file called robots.txt in your WordPress root folder will stop your site being included in indices like Google.

The following however is good for WordPress:

User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/

This tells engines to index the site but nor the two folders you can see. These two shouold be kept private. SImply make up a fiule and save it in your website’s root folder in a file called robots.txt.

 

Robots.txt as a WordPress setting

Edit your WordPress-based robots.txt file from the WordPress Admin using a WordPress Website plugin such as:

Christopher Davis’s, WP Robots Txt.

It’s  a plugin that adds an additional field to the “Reading” admin page.  With this installed and activated,  simply go into the WordPress menu option for website settings: Settings/Readings and scroll to the bottom and change information in the window below

Robots.txt Content

User-agent: *
Disallow: /wp-admin/
Disallow: /wp-includes/

Creating a WordPress menu exclusively for mobile responsive website design

First you need to add a function to your function.php file. Do this in your child theme folder. See creating a child theme.

First create the mobile menu in the Appearance -> Menus admin screen. Call it mobile-menu.

Now, in your theme’s functions.php, you need to write a function to register th names of your mobile menu. This is the name you gave them in the Appearance -> Menus admin screen above.  Here I am register one called ‘mobile-menu’

function register_my_menu() {
register_nav_menu(‘mobile-menu’,__( ‘menu-mobile’ ));
}
add_action(‘init’, ‘register_my_menu’ );

The next stage is to place the line below where your main menu is, in WordPress twenty fourteen it’s called primary. (There can be a secondary too). Look for the line below in the header.php file. (use a copy in the child folder)

<?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’ ) ); ?>

add below it this line:
<?php wp_nav_menu( array( ‘theme_location’ => ‘mobile-menu’, ‘menu_class’ => ‘mobile_menu’ ) ); ?>

Next add the following to your child theme’s style.css file.  Basically it works by checking the resolution of the screen before which of the WordPress menus are dispayed

/* hide mobile menu */
.mobile_menu {
display:none;
}
@media screen and (max-device-width : 480px) {
.primary-navigation{
display:none;
}
.mobile_menu {
display:block;
}
}
/* Tablets and lower */
@media screen and (max-width: 1008px) {
.primary-navigation {
display:none;
}
.tab_menu {
display:block;
}
}

Create your ‘movile-menu’ menu using the Appearance-menu  option

Done – now test it

Check out the WordPress Codex information. Really useful for a newbie WordPress website developer

 

Creating a WordPress child theme

As a WordPress developer you will need to get to grips with modifying the themes you are using for a website during its design. Child versions of themes are very important if you do modify a theme and wish to avoid losing your code during an update of the parent theme.

Create a folder on your webserver in the /wp-content/themes folder using FTP or your hostings file manager.  For example if the theme you are using is “twentyseventeen” and is set up in:

/wp-content/themes/twentyseventeen

then create

/wp-content/themes/twentyseventeen-child

In this folder create a  file called style.css and into the file place the following  code:

 

/*
 Theme Name:   Twenty Ten Child
 Theme URI:    https://yoursite.com/twenty-ten-child/
 Description:  Twenty Ten Child Theme
 Author:       Yourself
 Author URI:   https://example.com
 Template:     twentyseventeen
 License:      GNU General Public License v2 or later
 License URI:  https://www.gnu.org/licenses/gpl-2.0.html
*/
@import url("../twentyseventeen/style.css");
Simply add you replacement/overriding css here.

You may also place any modified files such as header.php, footer.php, sidebar.php in here too. These will overide the equivalent in the parent theme.

 

Change the theme to the child in the Appearance menu on the WordPress desktop.

What type of access to my WordPress site can I give my employees?

Summary of Roles

There are several WordPress roles you can give them beginning with the lowest

The Subscriber

Basically all they a can do is edit their site profile

The Contributor

Here they can ‘contribute’ to the site by adding and editing their own WordPress posts, but the finally say on whether they appear is yours.

The Author

This user can do everything a contributor can do, but they are able to publish the post themselves so that it appears on the site.

The Editor

Again, this user has the abilities of the earlier ones, but they can also edit other Author and Contributors posts.

The Administrator

Everything is possible by this type of users, including post and page additions and managagement, site design and menu maintenance.

The Super Admin

As for the Administrator, with the ability to manage WordPress Network features

Support