Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 02-14-2010, 05:43 PM   #1
HyperActive Warrior
 
Join Date: Dec 2008
Location: Oregon
Posts: 174
Thanks: 56
Thanked 12 Times in 9 Posts
Default Blocking line of code

Hey there,

I'm wondering if there is a way to easily shut down a line of code in a wordpress theme. Doing some tweaking to see what I like and what I don't like and I would like to shut down certain lines of code instead of removing them.

If I could just put some <tag> at the beginning of the line so it is ignored, then if I don't get the result I want I can just remove that tag again and its back the way it was.

No deleting or copy and paste and making sure I remember where I removed it from if I want to put it back.

Say for example I want to remove the sidebar, a little code blocker to see what happens before I actually remove it would be good.

Thanks very much!

Mm

Changing Life for my family "One" Click at a time.
Mmfh is offline   Reply With Quote
Old 02-14-2010, 06:18 PM   #2
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: Blocking line of code

WordPress themes (and WordPress itself) are PHP files containing a combination of PHP and raw HTML codes. So you could probably just comment out the lines you don't need.

If you have a standard bit of text you include with the comments you can search for it later and remove them all easily (assuming you're using a proper editor and not the one thats included in the WordPress dashboard).

Bill
mywebwork is offline   Reply With Quote
Old 02-14-2010, 09:14 PM   #3
Warrior Member
 
Join Date: Feb 2010
Posts: 11
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: Blocking line of code

Quote:
Originally Posted by mywebwork View Post
WordPress themes (and WordPress itself) are PHP files containing a combination of PHP and raw HTML codes. So you could probably just comment out the lines you don't need.

If you have a standard bit of text you include with the comments you can search for it later and remove them all easily (assuming you're using a proper editor and not the one thats included in the WordPress dashboard).

Bill
Specifically, to comment something out in php, you can put a double slash at the beginning of the line, or wrap multiple lines in /* */

like so:

PHP Code:
// this is a single line comment and will not be executed

/* 
This is a block comment and can wrap multiple lines.
*/ 
For HTML, you use the following for block comments:

Code:
<!--
This is an HTML comment and will be ignored by the browser.
-->
fr0ke is offline   Reply With Quote
Old 02-15-2010, 12:09 AM   #4
Veteran Marketer
War Room Member
 
Jeremy Morgan's Avatar
 
Join Date: Jul 2009
Location: Portland, OR
Posts: 516
Blog Entries: 10
Thanks: 46
Thanked 80 Times in 51 Posts
Social Networking View Member's Myspace Profile  View Member's Twitter Profile  View Member's YouTube Profile
Contact Info
Send a message via ICQ to Jeremy Morgan
Default Re: Blocking line of code

You can comment anything out you want, but be careful not to break the loop. If you comment out any <div> tags, make sure they are all self contained, meaning you aren't just commenting out a closing div or an opening div only. This will break the page. Done it many times, which is why I mention it.

Jeremy Morgan, SEO / Internet Marketer
My Portland Web Design Firm
Check out my SEO Blog for news, tips and tutorials
Jeremy Morgan is offline   Reply With Quote
Old 02-15-2010, 10:47 AM   #5
Personal hygiene coach
 
mojojuju's Avatar
 
Join Date: Aug 2005
Location: Potemkin Village
Posts: 1,083
Thanks: 268
Thanked 377 Times in 254 Posts
Social Networking View Member's Twitter Profile 
Default Re: Blocking line of code

I'll comment stuff out, delete it completely, or replace lines that I wish to. But I make a backup copy of the file first, usually in the format of OriginalFilename.php.bak.DateOfBackup.

So if I'm going to tweak a file called index.php, I'll back it up as index.php.bak.100215 first, and then I can carelessly edit away at the original file without worries.
mojojuju is online now   Reply With Quote
Old 02-15-2010, 07:32 PM   #6
HyperActive Warrior
 
Join Date: Dec 2008
Location: Oregon
Posts: 174
Thanks: 56
Thanked 12 Times in 9 Posts
Default Re: Blocking line of code

Thanks guys for your replies! I'm using the editor that is in the wordpress dashboard though. When you are in the editor your different pages appear on the right.

I always use static sites and never blogs so I like to get rid of the sidebar with the comments and links and all that stuff that just doesn't look good.

I will use the info given to let me try to remove things to see what happens before I actually delete anything.

Thanks very much!

Mm

Changing Life for my family "One" Click at a time.
Mmfh is offline   Reply With Quote
Old 02-15-2010, 08:14 PM   #7
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: Blocking line of code

When editing themes I usually find its best to:

A) Make a backup copy of the entire theme before editing

B) Download the theme files to my local workstation and use a proper text editor to do the work. The convenience of using a good set of tools more than makes up for the short delay in having to FTP the files up to the server to check the results.

Working on a local server or XAMPP installation of WordPress helps too.

Best of luck with your modifications.

Bill
mywebwork is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
blocking, code, line

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 03:15 PM.