Comments (40)
also add options to
- delete first post (
wp_delete_post(1, true);
) - delete sample page
- delete hello.php plugin
from sage.
I will try to fix this one this week.
from sage.
Yeah, I would steer clear of modifying the .htaccess. Leave this type of stuff to plugins, or at least return .htaccess to default after uninstalling theme. I tried Roots theme, but then decided it wasn't for me, but now my .htaccess is ruined. Of course, I didn't realize that my .htaccess was going to be touched in the first place, but guess I should of read more carefully before testing theme. Not for me.
from sage.
html5 boilerplate's .htaccess contains many goodies and we're trying to keep as much html5 boilerplate as possible in roots.
sorry that it currently doesn't warn you before doing it (we're working on it) but it's really meant to be used from a new install that you're starting from scratch on -- if you switch to roots from another theme it will modify lots of existing settings as documented on the wiki under theme activation
from sage.
Yep, the management of the .htaccess file has to be improved and secured. This is a sensible file that could lock un-aware people out of their blog easily.
I was thinking of a way to backup the existing one to maybe be able to restore it later (rename the file or whatever on demand or on theme deactivation).
Enable the edition of the .htaccess file directly in the backend could be a nice addition too but again, people need to be warned of what they may break.
What do you think ?
from sage.
@retlehs : just got your message now after submitting mine -- should we stick with the warning thing only or should I look into the backup thingy too ?
from sage.
i agree on all of the above -- i'd like to have editing the .htaccess as part of #5 as well
from sage.
I would suggest taking a hybrid approach, and consider dropping some of the html5 boilerplate in order to encourage a larger user (and possibly developer) base. The beauty of Wordpress is the flexibility of user-experience...one can import/export data and doesn't have to be locked in. In a way, you're creating a theme that could make users have to re-install Wordpress every time they want to use a different theme :-/ This is a bit of exaggeration, but I think you get the point. Sorry for harsh criticism, but trying to be helpful and not discouraging. Good luck!
from sage.
roots = html5 boilerplate + blueprint / 960 / 1140 (soon) + others to come
..but the whole point is that it's based on html5 boilerplate. if someone doesn't want that they really shouldn't even be considering trying roots, but we're definitely going to add in activation options (and theme settings) so that people can choose to enable/disable the htaccess enhancements
from sage.
I would recommend making a plugin out of it, and clearly documenting what the plugin is going to do so the user knows beforehand. Then you can say something like: "We highly recommend our plugin..." on the Roots site. And yes I would also recommend backing up the user's existing .htaccess and providing clear instructions on how to return to previous state.
from sage.
@colorful-tones : I think that as far as we "optionize" and deliver a way to get back to original settings (at least for important file like .htaccess), flexibility and user-experience should be safe ;-)
from sage.
it's not going to be moved to a plugin... there's lots of other plugin-type functionality in roots that also will be kept in the theme. it's simply going to be made an option.
we clearly document everything that's done in the wiki.
from sage.
I've been looking into this deeper today.
I was thinking of using a page that would replace the options page.
The theme wouldn't do anything until that page as been reached and submitted.
Then the regular option page would appear in its place.
We should be able to redirect to the "initial setup" page after activation and to display a notice until the initial setup is done.
Sounds good to you ?
from sage.
sounds great :)
from sage.
Now that we left the options framework idea behind us, I think I can spend some time on this one.
from sage.
Ok its shaping gently. I'm still in the process of implementing everything - nothing quite tested yet.
So the flow for now is :
At the "very first" activation --> roots page is set to the activation page.
Once the activation is submitted at least once --> its replaced by the usual options page.
My problem actually is that it seems that redefining the page while the post action is done leads to the replacing page not being ready aka "you don't have sufficient right to access this page" message.
If someone knows a way around this, or maybe something cleaner than what I'm doing now please give it a look in my activation-options branch.
It's time for me to get a walk and enjoy the sun ;-)
from sage.
Ok back from the park ... Gave me time to think about the bug --> for now I just redirect to the main admin page (dashboard). It does its job.
I was thinking of adding a "message" in the upper part of the screen like the "check that your .htaccess file is writeable" message. It may come later.
from sage.
Feedback ? ;-)
from sage.
it's good, thx john
one thing to add is a redirect to the activation page upon activating the theme (using wp_redirect)
i'll change up the ui a bit once i pull it in (but will wait until options page is changed so it'll all be the same)
from sage.
I'll try to find some spare time this week --- hopefully I'll succeed :p
from sage.
Mmm I've been pretty busy lately... I have some days off by the end of this week. ;-)
from sage.
i've had this bookmarked for a while.. https://gist.github.com/857430 (example code for doing activate/deactivate/uninstall hooks)
from sage.
Yap. But sadly I think it's only applicable to plugins.
from sage.
started work on this yesterday.. i've got the theme activation page mostly ready (just like how @johnraz had it in his earlier activation branch) but there's still a lot of functionality that needs to be done
found this as well: http://www.krishnakantsharma.com/2011/01/activationdeactivation-hook-for-wordpress-theme/
from sage.
Yeah ! Looks pretty sexy :-) I like the link too ! I'm gonna give this one a look.
from sage.
This will take it to the next level
from sage.
i want this so bad.
just made a new branch called activation and added the theme activation options page that i showed in my last comment but it's not functional at all at this point
from sage.
as mentioned in #100 by @r3df:
Are you still thinking of initialization options? Perhaps copying page.php to front-page.php during set-up could be done if "custom front page" is selected as an option? You could even have it selected by default, but that way if you don't want it, you un-check that option and you don't have to worry about it anymore on updates. and if you do have a custom front-page.php it won't get overwritten id you do an update, 'cause it's not in the source.
the copying could be done using the wordpress filesystem api (example in roots-htaccess.php)
from sage.
WordPress subdirectories.... on the earlier version I manually changed the code to account for WordPress being installed in a subdirectory. With this update I added a new variable:
$wp_subdir = ltrim( str_replace( get_bloginfo('siteurl') , '' , get_bloginfo('wpurl') ) , '/' ).'/';
then in the array:
$roots_new_non_wp_rules = array(
'css/(.*)' => $wp_subdir.'wp-content/themes/'. $theme_name . '/css/$1',...
but with this code, without the added code, and with the manual changes, I am get 404 errors all over the place, no css, etc. The .htaccess file looks the same as a backed up copy and when I switch back to an older roots based theme, I only get the 3 404 errors I've always gotten (which I expect are the wp-ecommerce peoples fault.) !?? Any suggestions ?
from sage.
@red-earth that's not related to this ticket or a roots issue since that's something you made on your own, please post over on http://groups.google.com/group/roots-theme
from sage.
@retlehs : Shouldn't we finally kill this as a wish for 2012 ? :-) Can you sum what's left to do on this ?
from sage.
Ok I started working on this again.
I think I found a nice way to work around this issue.
My idea is the following:
- set up an option to know if the theme has been activated yet.
- if that option is false, create the activation page only (no option page for the theme yet).
- once the user has saved the activation page, create the regular option page and redirect to it.
(this is what you can see for now in my fork's master branch) - next step is to execute the actual activation based on the options set when saving the activation page (the trick here is to only execute this once, I think this can be achieved by settings each 'activation option' back to false, so they ain't executed).
- and that's it basically.
I'll put some time to finish this tomorrow (hopefully).
Let me know how you feel about this solution ;-)
from sage.
@johnraz i'm going to check this out shortly, but based on the commit i see on your activation branch it looks pretty good :)
from sage.
fyi it looks like your fork is a little behind, specifically the functions.php file
Fatal error: Cannot redeclare roots_robots() (previously declared in functions.php:61) in inc/roots-cleanup.php on line 395
from sage.
Just fixed that a few minutes ago, I just pushed, should be ok now.
from sage.
awesome :)
so on a fresh wordpress install i went and activated the theme. i see the new 'theme activation' menu link but i'm not redirected to that page after activating the theme. this is the code we should use for that (slightly tweaked from what you have in there currently):
if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
wp_redirect(admin_url('themes.php?page=theme_options'));
exit;
}
also, rather than creating a new menu item for 'theme activation' i think it might be better to just utilize the theme options page but show the activation page instead of regular theme options if that option hasn't been set/saved yet. thoughts?
from sage.
The redirect was there to redirect to the option page after you submited the activation form ;-).
The code you suggest can be used too to redirect after switching to roots. Both plays well together.
I kinda liked the idea of having a different title in the menu for the activation page (having an item "Theme activation" makes more sens than having "Theme options" but that's my view).
Also I'm thinking of having a separated option array like "roots_activation" or something to make things clearer and better separated.
Agree ?
from sage.
ahhh. yeah we should use both
okay, keeping 'theme activation' makes sense
separated option array sounds good!
from sage.
Perfect!
I'd love to see this closed by the end of the week!
I'll do what I can ;-)
from sage.
New pull request has been made ... Should fix it and merge nicely in master ;-)
from sage.
Related Issues (20)
- Bug: Sage 10.5 keeps reporting Acorn not available HOT 4
- Bug: Failed to compile CSS/SCSS When curly braces is present on css class as dynamic value for mixin HOT 1
- Bug: tailwind plugins import issue HOT 3
- Method ReflectionParameter::getClass() is deprecated Bug: HOT 1
- Bug: > cache/acorn/framework/cache directory must be present and writable HOT 1
- ❤️ Feature Request: static analysis of blade templates HOT 1
- Sage is incompatible with symbolic links : Unrecognized file extension HOT 1
- Replace single line PHP statements HOT 1
- Sage 9 + Wordpress 6.3 : Notice: Error when decoding a JSON file at path... HOT 3
- Can Sage 10 integrate React and use shadcn/ui? HOT 1
- Hot reload not working (Redirecting to base URL when front page is set) HOT 1
- @import tailwind syntax is not supported and can cause issues with bud cache
- Unable to use @import on css files HOT 1
- Use modern Yarn install
- [sage 9] page-template not working on wordpress 6.4 HOT 1
- Sage 10 tailwind css is not working without small addition to tailwind.config.js HOT 5
- Sage 9 + Wordpress 6.4 and 6.4.1 create broken Gutenberg layout HOT 3
- Admin bar breaking error pages HOT 1
- Seems eslint --fix doesn't apply prettier changes HOT 1
- do_action('get_header') should occur before wp_head() HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sage.