martinforsyth
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Simple integration of WP and AngularJSThx kartiks16
I have seen some of that material already. It’s a bit more heavyweight than what i’m after. I’m trying to avoid getting into too much by the way of theme/plugin creation in order to get this working.
In a way, i’m less interested in building a working AngularJS app and more interested in why it doesn’t work for me in what seems to be a simple case. No doubt there’s something i’m not fully understanding. It’s that which i really want to find out about.
Oh dear!!! Afraid i have made a classic mistake!
I have been investigating this issue on a WP multisite installation and looking at the wrong wp_options database table!
Going right back to my original post – the site does in fact behave as i would have thought, namely that the change is persisted in the wp_options table.
For anyone who’s interested, this is what i did …
1.
Before making any changes …a.
Copy WP source tree …
sudo cp -r /var/www/html/wordpress-root ~/tmp/sitestate/a/.b.
Dump options table data …
mysql --user=.. --password=.. --database=wordpress --execute="select * from wp_3_options" |tee ~/tmp/sitestate/a/wp_3_options2.
Use WP admin UI -> Customize to add a widget to the sidebar, then …a.
Copy WP source tree …
sudo cp -r /var/www/html/wordpress-root ~/tmp/sitestate/b/.b.
Dump options table data …
mysql --user=.. --password=.. --database=wordpress --execute="select * from wp_3_options" |tee ~/tmp/sitestate/b/wp_3_options3.
Perfom a recursive cli diff on the before/after data …
diff -r --brief ~/tmp/sitestate/a ~/tmp/sitestate/b
which yielded ..
Files /home/martin/tmp/sitestate/a/wp_3_options and /home/martin/tmp/sitestate/b/wp_3_options differ4.
Inspecting those diffs shows the ‘expected’ differences in thewidget_categoriesandsidebars_widgetsfields.Thx for that Jarret, good description – i get it 🙂
My site is local on my own desktop (Ubuntu 18.04), running Apache. Simple setup – no extra WP plugins to implement caching. (I appreciate that browsers have native caching, and maybe so too does Apache).
I’m going to play around with my setup a bit more (clearing caches, restarting, using different browsers etc etc) just to convince myself that ultimately, a change such as adding the Recent Posts widget to the sidebar must eventually be persisted in the database or a file on the server. It’s not so much the functionality of the Recent Posts widget i’m interested in now (thanks to your explanation) – more the different ‘states’ of the site corresponding to the presence or absence of the widget itself in the sidebar.
Thx for response Jarret.
I’ll have to look into this a bit more. I’m pretty sure there’s something basic i’m not fully understanding.
ATM i’m thinking that in order to persist in the site, so that any ‘end user’ anywhere can view in any browser the changes made via the customize interface, then the changes have to be stored somewhere ‘in’ the site – don’t they? Namely either the site’s source code (
wp-content, wp-admin, wp-includesetc etc – i’d expectwp-content/themes) or WP DB (i’d expect the options table) as these are the only places where persistent changes can be stored aren’t they?I’m currently working through the documentation in https://codex.wordpress.org/Theme_Customization_API for some pointers.