![]() | | ||||||||
| | #1 |
| HyperActive Warrior Join Date: Dec 2008 Location: Oregon
Posts: 174
Thanks: 56
Thanked 12 Times in 9 Posts
|
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. | |
| | |
| | #2 |
| Senior Warrior Member War Room Member Join Date: Sep 2008 Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1 Thanks: 759
Thanked 724 Times in 505 Posts
|
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 |
| | |
| | #3 | |
| Warrior Member Join Date: Feb 2010
Posts: 11
Thanks: 0
Thanked 2 Times in 2 Posts
| Quote:
like so: PHP Code: Code: <!-- This is an HTML comment and will be ignored by the browser. --> | |
| | |
| | #4 |
| Veteran Marketer War Room Member Join Date: Jul 2009 Location: Portland, OR
Posts: 516
Blog Entries: 10 Thanks: 46
Thanked 80 Times in 51 Posts
|
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 | |
| | |
| | #5 |
| Personal hygiene coach Join Date: Aug 2005 Location: Potemkin Village
Posts: 1,083
Thanks: 268
Thanked 377 Times in 254 Posts
|
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. |
| | |
| | #6 |
| HyperActive Warrior Join Date: Dec 2008 Location: Oregon
Posts: 174
Thanks: 56
Thanked 12 Times in 9 Posts
|
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. | |
| | |
| | #7 |
| Senior Warrior Member War Room Member Join Date: Sep 2008 Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1 Thanks: 759
Thanked 724 Times in 505 Posts
|
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 |
| | |
![]() |
|
| Tags |
| blocking, code, line |
| Thread Tools | |
| |
![]() |