![]() |
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 |
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 |
Re: Blocking line of code Quote:
like so: PHP Code: Code: <!-- |
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. ;) |
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. |
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 |
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 |
| All times are GMT -6. The time now is 02:42 AM. |