Bible verse tags 2.0

A few years ago a friend and I created the bible verse tags for phpbb forums and then I decided to switch from using phpbb and a portal page as my blog to using proper blogging software and avoid all the update headaches due to the massive amounts of modifications I had to do just to get it to work they way I wanted it to work.
After staying up late adding my template to wordpress I really missed having the bible verse tags so I decided to try to get them to work on wordpress.

Success! 🙂 It was not very hard to modify the phpbb mod to work with wordpress. Unfortunately, I’ve never been happy with its performance or structure so in the middle of December 2006 I had some time off and decided to rewrite it from the ground up. I’ve compacted the code (about 50% fewer lines of code, 1 regular expression instead of the 9 regular expressions in version 1) all while adding functionality to the modification (you can now add more bible databases, including different versions and languages and the error messages are actually meaningful) and properly normalizing and indexing the database (the strange thing is that it started out normalized and for some reason it was decided to unnormalize it).

To get them for your wordpress blog the first thing you must do is install the text of the Holy Bible, a list of books and an information table into a MySQL database on your server. You will need to download the following:

Then create a new database and add a user and password to it. Keep all of this information for later. Then use phpMyAdmin to import the .sql files mentioned above into the database. If you uncompress the .sql files you may have to break the large bible text files up into five or more pieces to install it because of their large size. Your server may time out before it is complete if you do not. Leave them in their .gz compressed state and you should be able to import them as is.

Next, open the plugin file (bible_verses_for_WP.php included in the downloads above) and modify the user configuration area.

The MySQL database settings are the database name, user name and password from above when you set up your database with the Bible verses.

If you are not using the King James version as your default bible then change the default setting.

// User Configuration :
#####################################################
// MySQL Database Settings
$server = "localhost"; // Your MySQL Server
$db_user = ""; // Your MySQL Username
$db_pass = ""; // Your MySQL Password
$verse_database = ""; // Database Name
// CSS Styles
$verseHeader_style = "quotehead"; // CSS Style Name
$noverseHeader_style = "nohead"; // CSS Style Name
$noverse_style = "noverse"; // CSS Style Name
$verseBody_style = "verse"; // CSS Style Name
$verseNum_style = "<sup>"; // CSS Style Code for Superscript Verse Number
$verseNum_end = "</sup>"; // CSS Style Code for Superscript Verse Number
// Bible script settings
$defaultVersion = "kjv";
#####################################################

The CSS styles may be set to your liking. My settings are like this:
.quotehead {
display: block;
font-weight: bold;
font-size: 0.9em;
text-align: left;
margin: 12px 0 0 20px;
}

.nohead {
display: block;
font-weight: bold;
font-size: 0.9em;
text-align: left;
margin: 12px 0 0 20px;
color: #f00;
}

.noverse {
display: block;
max-width: 90%;
color: #ff0000;
font-size: 0.9em;
text-align: left;
margin-left: 20px;
padding: 5px;
border: solid 2px #222;
background:#ccc;
}

.verse {
display: block;
max-width: 90%;
font-size: 0.9em;
text-align: left;
margin-left: 20px;
padding: 5px;
border: solid 2px #222;
}

sup {
font-size: 0.5em;
vertical-align: top;
}

span i {
display: block;
font-style: italic;
font-size: .7em;
text-align: right;
margin: 0 2px;
}

You may add them to your regular css file as is or tweak them to look proper in your personal theme. I would suggest making the superscript (sup) tag similar to what I have above so that the verse numbers will not mess with the line-height when the verses are shown.

After making all the changes to the bible_verse.php file you may upload it to your plugins folder and go to your Admin >> Plugins and activate the Bible Verse Mod.

Below are examples of Version which is active on this site now.

Here is a quick explanation of how the bible tags work:

If you type [bible]John 3:16[/bible] into a post, page or comment it will look like this John 3:16For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. - King James Version when your message is read.

You can do single verses:
Genesis 1:1In the beginning God created the heaven and the earth. - King James Version
1 Samuel 1:1Now there was a certain man of Ramathaimzophim, of mount Ephraim, and his name was Elkanah, the son of Jeroham, the son of Elihu, the son of Tohu, the son of Zuph, an Ephrathite: - King James Version

you can do a range of verses:
Romans 1:1-51Paul, a servant of Jesus Christ, called to be an apostle, separated unto the gospel of God,  2(Which he had promised afore by his prophets in the holy scriptures,)  3Concerning his Son Jesus Christ our Lord, which was made of the seed of David according to the flesh;  4And declared to be the Son of God with power, according to the spirit of holiness, by the resurrection from the dead:  5By whom we have received grace and apostleship, for obedience to the faith among all nations, for his name:   - King James Version
1 Corinthians 1:1-31Paul, called to be an apostle of Jesus Christ through the will of God, and Sosthenes our brother,  2Unto the church of God which is at Corinth, to them that are sanctified in Christ Jesus, called to be saints, with all that in every place call upon the name of Jesus Christ our Lord, both theirs and ours:  3Grace be unto you, and peace, from God our Father, and from the Lord Jesus Christ.   - King James Version

or you can do entire chapters:
Psalms 1001A Psalm of praise. Make a joyful noise unto the LORD, all ye lands.  2Serve the LORD with gladness: come before his presence with singing.  3Know ye that the LORD he is God: it is he that hath made us, and not we ourselves; we are his people, and the sheep of his pasture.  4Enter into his gates with thanksgiving, and into his courts with praise: be thankful unto him, and bless his name.  5For the LORD is good; his mercy is everlasting; and his truth endureth to all generations.     - King James Version
1 John 21My little children, these things write I unto you, that ye sin not. And if any man sin, we have an advocate with the Father, Jesus Christ the righteous:  2And he is the propitiation for our sins: and not for ours only, but also for the sins of the whole world.  3And hereby we do know that we know him, if we keep his commandments.  4He that saith, I know him, and keepeth not his commandments, is a liar, and the truth is not in him.  5But whoso keepeth his word, in him verily is the love of God perfected: hereby know we that we are in him.  6He that saith he abideth in him ought himself also so to walk, even as he walked.  7Brethren, I write no new commandment unto you, but an old commandment which ye had from the beginning. The old commandment is the word which ye have heard from the beginning.  8Again, a new commandment I write unto you, which thing is true in him and in you: because the darkness is past, and the true light now shineth.  9He that saith he is in the light, and hateth his brother, is in darkness even until now.  10He that loveth his brother abideth in the light, and there is none occasion of stumbling in him.  11But he that hateth his brother is in darkness, and walketh in darkness, and knoweth not whither he goeth, because that darkness hath blinded his eyes.  12I write unto you, little children, because your sins are forgiven you for his name's sake.  13I write unto you, fathers, because ye have known him that is from the beginning. I write unto you, young men, because ye have overcome the wicked one. I write unto you, little children, because ye have known the Father.  14I have written unto you, fathers, because ye have known him that is from the beginning. I have written unto you, young men, because ye are strong, and the word of God abideth in you, and ye have overcome the wicked one.  15Love not the world, neither the things that are in the world. If any man love the world, the love of the Father is not in him.  16For all that is in the world, the lust of the flesh, and the lust of the eyes, and the pride of life, is not of the Father, but is of the world.  17And the world passeth away, and the lust thereof: but he that doeth the will of God abideth for ever.  18Little children, it is the last time: and as ye have heard that antichrist shall come, even now are there many antichrists; whereby we know that it is the last time.  19They went out from us, but they were not of us; for if they had been of us, they would no doubt have continued with us: but they went out, that they might be made manifest that they were not all of us.  20But ye have an unction from the Holy One, and ye know all things.  21I have not written unto you because ye know not the truth, but because ye know it, and that no lie is of the truth.  22Who is a liar but he that denieth that Jesus is the Christ? He is antichrist, that denieth the Father and the Son.  23Whosoever denieth the Son, the same hath not the Father: (but) he that acknowledgeth the Son hath the Father also.  24Let that therefore abide in you, which ye have heard from the beginning. If that which ye have heard from the beginning shall remain in you, ye also shall continue in the Son, and in the Father.  25And this is the promise that he hath promised us, even eternal life.  26These things have I written unto you concerning them that seduce you.  27But the anointing which ye have received of him abideth in you, and ye need not that any man teach you: but as the same anointing teacheth you of all things, and is truth, and is no lie, and even as it hath taught you, ye shall abide in him.  28And now, little children, abide in him; that, when he shall appear, we may have confidence, and not be ashamed before him at his coming.  29If ye know that he is righteous, ye know that every one that doeth righteousness is born of him.     - King James Version

some spelling errors are taken into consideration:
Revelation 1:12And I turned to see the voice that spake with me. And being turned, I saw seven golden candlesticks; - King James Version
That should be Revelation instead of Revelations (it is not plural). As you can see it has been taken into account and corrected.

Psalms 91:10There shall no evil befall thee, neither shall any plague come nigh thy dwelling. - King James Version
That should be Psalms instead of Psalm (it is not singular). As you see it has also been corrected.

Certain abbreviations have also been included such as Psa for Psalms and Gen for Genesis, etc.
Psalms 911He that dwelleth in the secret place of the most High shall abide under the shadow of the Almighty.  2I will say of the LORD, He is my refuge and my fortress: my God; in him will I trust.  3Surely he shall deliver thee from the snare of the fowler, and from the noisome pestilence.  4He shall cover thee with his feathers, and under his wings shalt thou trust: his truth shall be thy shield and buckler.  5Thou shalt not be afraid for the terror by night; nor for the arrow that flieth by day;  6Nor for the pestilence that walketh in darkness; nor for the destruction that wasteth at noonday.  7A thousand shall fall at thy side, and ten thousand at thy right hand; but it shall not come nigh thee.  8Only with thine eyes shalt thou behold and see the reward of the wicked.  9Because thou hast made the LORD, which is my refuge, even the most High, thy habitation;  10There shall no evil befall thee, neither shall any plague come nigh thy dwelling.  11For he shall give his angels charge over thee, to keep thee in all thy ways.  12They shall bear thee up in their hands, lest thou dash thy foot against a stone.  13Thou shalt tread upon the lion and adder: the young lion and the dragon shalt thou trample under feet.  14Because he hath set his love upon me, therefore will I deliver him: I will set him on high, because he hath known my name.  15He shall call upon me, and I will answer him: I will be with him in trouble; I will deliver him, and honour him.  16With long life will I satisfy him, and show him my salvation.     - King James Version
Genesis 3:20And Adam called his wife's name Eve; because she was the mother of all living. - King James Version Notice that the verse name is expanded to its complete name when returned.

Errors that can not be corrected will look like this:
Verse not found.There was no verse found at Cheese 11:32 (KJV). Please make sure the book is spelled correctly and that the chapter and verse exists. Also, ensure that the version of the Bible you are quoting is available on this server.

To use different versions included in your database the format is:
[bible=luther]Johannes 3:16[/bible]

Johannes 3:16Also hat Gott die Welt geliebt, daß er seinen eingeborenen Sohn gab, auf daß alle, die an ihn glauben, nicht verloren werden, sondern das ewige Leben haben. - Luther bibel
1 Könige 2:2-42Ich gehe hin den Weg aller Welt. So sei nun stark und sei ein Mann   3und beobachte die Verordnungen des HERRN, deines Gottes, daß du in seinen Wegen wandelst, seine Satzungen, seine Gebote, seine Rechte und seine Zeugnisse haltest, wie im Gesetze Moses geschrieben steht, auf daß du weislich vollbringest alles, was du tust und wohin du dich wendest;   4daß der HERR sein Wort bestätige, das er über mich geredet hat, indem er sagte: Werden deine Kinder auf ihre Wege achten, daß sie in Wahrheit vor mir wandeln, mit ihrem ganzen Herzen und mit ihrer ganzen Seele, so soll es dir nimmer (sprach er) an einem Manne fehlen auf dem Throne Israels!    - Schlachter bibel
Sprüche 26:13-1413Der Faule spricht: Der Brüller ist auf dem Wege, ein Löwe inmitten der Straßen.   14Die Tür dreht sich in ihrer Angel: so der Faule auf seinem Bette.    - Elberfelder bibel
For the foreign language bibles to work properly you will need to set your content type character set to UTF-8 or else you will not see the extended letters in the alphabets (such as ö, ü and ß) and using umlaut letters inside the tags will not work properly as the content will not match the UTF-8 content in the database. UTF-8 will not affect english language letters so its a win-win situation:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Let me know what you think of it or if you need help using these new tags. God bless you!a href=”/Bible_SQLs/asv.sql.gz”

15 thoughts on “Bible verse tags 2.0”

  1. 1 Corinthians 3:12Now if any man build upon this foundation gold, silver, precious stones, wood, hay, stubble; - King James Version
    1 Mose 1:1Im Anfang schuf Gott den Himmel und die Erde.
    - Schlachter bibel

    Proverbs 13:22-2422A good man leaveth an inheritance to his children's children: and the wealth of the sinner is laid up for the just.  23Much food is in the tillage of the poor: but there is that is destroyed for want of judgment.  24He that spareth his rod hateth his son: but he that loveth him chasteneth him betimes.   - King James Version

  2. 1 Könige 1:1Als aber der König David alt und hochbetagt war, konnte er nicht warm werden, obgleich man ihn mit Kleidern bedeckte.
    - Schlachter bibel

  3. Verse not found.There were no verses found at cheese 1 (KJV). Please make sure the book is spelled correctly and that the chapter exists. Also, ensure that the version of the Bible you are quoting is available on this server.
    Verse not found.There was no verse found at cheese 1:1 (KJV). Please make sure the book is spelled correctly and that the chapter and verse exists. Also, ensure that the version of the Bible you are quoting is available on this server.
    Verse not found.There were no verses found at cheese 1:1-2 (KJV). Please make sure the book is spelled correctly and that the chapter and verses exist. Also, ensure that the version of the Bible you are quoting is available on this server.

    Apparently there is no book about cheese in the bible. Hmm.

  4. Danish bible (dansk bibel) added:
    Første Kongebog 1:12Lad mig nu give dig et Råd, for at du kan redde dit eget og din søn Salomos Liv:
    - Dansk bibel

  5. Pingback: Cao's Blog
  6. Hello. I tried to import the database files but got an error #1064 about the DefaultCharset=8. What can be done about this?

  7. Change the syntax of the mysql commands to work with the version of mysql you are using. The version I am using is 4.1.21 and that is the version from which the sql files were exported.

  8. Everything imported successfully and it works fine for some verses. But it will not work for others. Even within the same book of the bible. Like John 3:16 will work. But John 1:1 will not. Any idea why that could happen?

  9. Never mind. I figured it out. The wordpress editor was adding extra code around the [bible] tag sometimes.

  10. If anyone is having trouble inserting one of the bible sql files into your database remember that you can leave it compressed as a .gz file during the insert. This should allow it to insert without timing out.

  11. Pingback: The Lawnparty
  12. Deuteronomy 81All the commandments which I command thee this day shall ye observe to do, that ye may live, and multiply, and go in and possess the land which the LORD sware unto your fathers.  2And thou shalt remember all the way which the LORD thy God led thee these forty years in the wilderness, to humble thee, and to prove thee, to know what was in thine heart, whether thou wouldest keep his commandments, or no.  3And he humbled thee, and suffered thee to hunger, and fed thee with manna, which thou knewest not, neither did thy fathers know; that he might make thee know that man doth not live by bread only, but by every word that proceedeth out of the mouth of the LORD doth man live.  4Thy raiment waxed not old upon thee, neither did thy foot swell, these forty years.  5Thou shalt also consider in thine heart, that, as a man chasteneth his son, so the LORD thy God chasteneth thee.  6Therefore thou shalt keep the commandments of the LORD thy God, to walk in his ways, and to fear him.  7For the LORD thy God bringeth thee into a good land, a land of brooks of water, of fountains and depths that spring out of valleys and hills;  8A land of wheat, and barley, and vines, and fig trees, and pomegranates; a land of oil olive, and honey;  9A land wherein thou shalt eat bread without scarceness, thou shalt not lack any thing in it; a land whose stones are iron, and out of whose hills thou mayest dig brass.  10When thou hast eaten and art full, then thou shalt bless the LORD thy God for the good land which he hath given thee.  11Beware that thou forget not the LORD thy God, in not keeping his commandments, and his judgments, and his statutes, which I command thee this day:  12Lest when thou hast eaten and art full, and hast built goodly houses, and dwelt therein;  13And when thy herds and thy flocks multiply, and thy silver and thy gold is multiplied, and all that thou hast is multiplied;  14Then thine heart be lifted up, and thou forget the LORD thy God, which brought thee forth out of the land of Egypt, from the house of bondage;  15Who led thee through that great and terrible wilderness, wherein were fiery serpents, and scorpions, and drought, where there was no water; who brought thee forth water out of the rock of flint;  16Who fed thee in the wilderness with manna, which thy fathers knew not, that he might humble thee, and that he might prove thee, to do thee good at thy latter end;  17And thou say in thine heart, My power and the might of mine hand hath gotten me this wealth.  18But thou shalt remember the LORD thy God: for it is he that giveth thee power to get wealth, that he may establish his covenant which he sware unto thy fathers, as it is this day.  19And it shall be, if thou do at all forget the LORD thy God, and walk after other gods, and serve them, and worship them, I testify against you this day that ye shall surely perish.  20As the nations which the LORD destroyeth before your face, so shall ye perish; because ye would not be obedient unto the voice of the LORD your God.     - King James Version

Comments are closed.