Skip to content

Commit 3dda5d2

Browse files
authored
Update readme.md
1 parent f96ad75 commit 3dda5d2

1 file changed

Lines changed: 139 additions & 30 deletions

File tree

readme.md

Lines changed: 139 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,153 @@
11
WECHANGE COLLECTION
2-
===================
32

4-
This plugin combines some nice utilities to integrate WECHANGE with your WordPress site.
3+
WECHANGE works very well with WordPress CMS. Usually the homepage and all informational pages are powered by WordPress. Therefor we recommend to run WordPress in a subdirectory (e.g. wechange.de/cms). We usually use the Divi theme but of course you're free to choose.
54

6-
Currently there is:
7-
- a shortcode for fetch statistics
8-
- a shortcode to show projects
9-
- a shortcode to show notes
10-
- a shortcode to show events
11-
- a utility to redirect logged in users directly to the WECHANGE platform
5+
In order to integrate WECHANGE data into WordPress pages, you can
6+
7+
install our projects shortcode plugin: https://github.com/wechange-eg/wordpress-plugin (see below)
8+
reuse and adapt our code snippets at https://gist.github.com/simonline/f3ded7504701ce0594992184b6729246
9+
make use of our API directly within your Javascript code or custom WordPress plugin: https://wechange.de/swagger/
10+
11+
Wechange-WordPress-Plugin
12+
13+
This plugin combines some nice utilities to integrate WECHANGE with your WordPress site and introduces a shortcode to display projects (and/or groups) from a WECHANGE platform.
14+
15+
Currently there are:
16+
17+
a shortcode for fetch statistics
18+
a shortcode to show projects / groups
19+
a shortcode to show notes
20+
a shortcode to show events
21+
a utility to redirect logged in users directly to the WECHANGE platform
1222

1323
SETUP
14-
-----
1524

16-
There is a Constant needed in the wp-config file called WECHANGE_BASE_URL
17-
define it like this
18-
`define('WECHANGE_BASE_URL', 'https://yourinstallation.tld' );`
25+
There is a Constant needed in the wp-config file called WECHANGE_BASE_URL define it like this
1926

20-
If you intstallation has multiple partners you can define a scope - eg. for separate statistisc
21-
`define('WECHANGE_SCOPE', 'thispartner');`
27+
define('WECHANGE_BASE_URL', 'https://yourinstallation.tld' );
2228

23-
Default caching time for content that is fetched from the API is 2 hours.
24-
There are filter to overwrite this.
29+
If you intstallation has multiple partners you can define a scope - eg. for separate statistisc
2530

26-
The utility to redirect logged in users to the platform is disabled by default.
27-
Activate it like this in your theme:
28-
`add_theme_support( 'wechange-collection-login-status' );`
31+
define('WECHANGE_SCOPE', 'thispartner');
2932

3033
All template files can be overwritten - see the template files for more information.
3134

3235
The plugin can be translated. See the language folder.
36+
What are the shortcodes actually doing?
37+
38+
When you place a shortcode in your side, the shortcode will
39+
40+
Call the API of your WECHANGE installation (defined via Constant or manually set)
41+
API response will be cached (per default for 2 hours).
42+
The response is themed through template files (can be overwritten to your preference)
43+
The result is echoed at the place you put the shortcode
44+
45+
Usage
46+
Statistics Shortcode
47+
48+
This shortcode will echo one plain number (or an error message) - this number can be styled through the surrounding element who ever you want.
49+
50+
[wechange-statistics attribute="SomeAttribute"]
51+
52+
Known attributes:
53+
54+
number of active users:
55+
56+
[wechange-statistics attribute="users_active"]
57+
58+
number of projects:
59+
60+
[wechange-statistics attribute="projects"]
61+
62+
number of notes:
63+
64+
[wechange-statistics attribute="notes"]
65+
66+
If WECHANGE_SCOPE is set, than the statistics are for this partner only, not for all partners on that installation.
67+
68+
available filters
69+
70+
cache time
71+
72+
apply_filters( 'wechange_collection_cache_time_statistics', 'addValueInSecondsHere' )
73+
74+
Notes Shortcode
75+
76+
Usage like
77+
78+
[wechange_notes parameters="limit=3&group=534"]
79+
80+
There are two possible parameters
81+
82+
'url' - is not needed if WECHANGE_BASE_URL is set
83+
'parameters' - which is attached to the basic API call. In this example we limit the answer to 3 items and just take notes from group 534 - see API documentation for further parameters
84+
85+
available filters
86+
87+
apply_filters( 'wechange_collection_cache_time_notes', 'TimeInSecondsHere' ); // caching time in seconds
88+
apply_filters( 'wechange_collection_notes_html_before', '<section class="wechange-events">'); // html before the listing of items
89+
apply_filters( 'wechange_collection_notes_html_after', '</section>'); // html after the listing of items
90+
91+
Projects Shortcode
92+
93+
Usage like
94+
95+
[wechange_projects parameters="limit=3"]
96+
97+
There are two possible parameters
98+
99+
'url' - is not needed if WECHANGE_BASE_URL is set
100+
'parameters' - which is attached to the basic API call. In this example we limit the answer to 3 items - see API documentation for further parameters
101+
102+
available filters
103+
104+
apply_filters( 'wechange_collection_cache_time_projects', 'TimeInSecondsHere' ); // caching time in seconds
105+
apply_filters( 'wechange_collection_projects_html_before', '<section class="wechange-events">'); // html before the listing of items
106+
apply_filters( 'wechange_collection_projects_html_after', '</section>'); // html after the listing of items
107+
108+
Conferences Shortcode
109+
110+
Usage like
111+
112+
[wechange_conferences parameters="limit=3"]
113+
114+
There are two possible parameters
115+
116+
'url' - is not needed if WECHANGE_BASE_URL is set
117+
'parameters' - which is attached to the basic API call. In this example we limit the answer to 3 items - see API documentation for further parameters
118+
119+
available filters
120+
121+
apply_filters( 'wechange_collection_cache_time_conferences', 'TimeInSecondsHere' ); // caching time in seconds
122+
apply_filters( 'wechange_collection_conferences_html_before', '<section class="wechange-events">'); // html before the listing of items
123+
apply_filters( 'wechange_collection_conferences_html_after', '</section>'); // html after the listing of items
124+
125+
Events Shortcode
126+
127+
Usage like
128+
129+
[wechange_events parameters="limit=3" upcoming="true"]
130+
131+
There are three possible parameters
132+
133+
'url' - is not needed if WECHANGE_BASE_URL is set
134+
'upcoming' - just show events in the future (default: true - only show events in the future)
135+
'parameters' - which is attached to the basic API call. In this example we limit the answer to 3 items - see API documentation for further parameters
136+
137+
available filters
138+
139+
apply_filters( 'wechange_collection_cache_time_events', 'TimeInSecondsHere' ); // caching time in seconds
140+
apply_filters( 'wechange_collection_events_html_before', '<section class="wechange-events">'); // html before the listing of items
141+
apply_filters( 'wechange_collection_events_html_after', '</section>'); // html after the listing of items
142+
143+
Plugin wide filters
144+
145+
apply_filters( 'wechange_collection_cache_time', 2 * HOUR_IN_SECONDS ); // standard caching time are 2 hours - while building maybe set to zero
146+
147+
Redirect users who are logged in in WECHANGE from WordPress to WECHANGE
148+
149+
activate by adding The utility to redirect logged in users to the platform is disabled by default. Activate it by putting this code eg in your themes functions.php:
150+
151+
add_theme_support( 'wechange-collection-login-status' );
33152

34-
It might be handy to disable caching for wp_debug:
35-
```
36-
add_filter( 'wechange_collection_cache_time', 'wechange_collection_disable_cache_for_debug' );
37-
function wechange_collection_disable_cache_for_debug( $cache_time ) {
38-
if ( true === WP_DEBUG ) {
39-
return 1; // cache time in seconds - 0 means: never change
40-
}
41-
return $cache_time;
42-
}
43-
```
44-
Remember to flush transients after doing that.
153+
This will embed a small JS file.

0 commit comments

Comments
 (0)