PluginProbe
Gianism / trunk
Gianism vtrunk
4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.4.0 5.0.0 5.0.1 5.0.2 5.1.0 5.2.1 5.2.2 5.3.0 6.0.0 6.0.1 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 65 releases
gianism / templates / customize.php

customize.php in Gianism trunk, at templates/customize.php

154 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) or die();
4
5 /** @var \Gianism\UI\SettingScreen $this */
6 ?>
7
8
9 <h3><?php $this->e( 'Change Login Button' ); ?></h3>
10 <p class="description">
11 <?php $this->e( 'You can change the appearance of login button.' ); ?>
12 </p>
13 <pre class="brush: php">
14 /**
15 * <?php $this->e( 'You can customize Facebook login button like this' ); ?>
16
17 * @param string $markup
18 * @param string $link
19 * @param string $title
20 * @param boolean $link
21 * @param string $service facebook, google, etc.
22 */
23 function _my_login_link_facebook($markup, $link, $title, $is_register, $service){
24 return '&lt;a class="my_fb_link my_fb_link_{$service}" href="'.$link.'"&gt;'.$title.'&lt;/a&gt;';
25 }
26 // Add filter.
27 add_filter('gianism_link_html', '_my_login_link_facebook', 10, 5);
28 </pre>
29
30 <h3><?php $this->e( 'Change Redirect' ); ?></h3>
31
32 <p class="description">
33 <?php $this->e( 'You can hook on redirect URL after user logged in.' ); ?>
34 </p>
35
36 <pre class="brush: php">
37 /**
38 * Customize redirect URL
39 * @param string $url if not specified, null will be passed.
40 * @param string $service facebook, twitter, etc.
41 * @param string $context login, connect, etc.
42 * @return string URL string to redirect to. Null is no-redirect.
43 */
44 function _my_redirect_to($url, $service, $context){
45 //<?php $this->e( 'Now you can get redirect URL.' ); ?>
46
47 //<?php $this->e( 'Not specified, $url is null.' ); ?>
48
49 return home_url();
50 }
51 // Add filter.
52 add_filter('gianism_redirect_to', '_my_redirect_to', 10, 3);
53 </pre>
54
55 <p class="notice">
56 <?php $this->e( '<strong>Note:</strong> Redirect occurs on various situations. If you are not enough aware of WordPress URL process, some troubles might occurs.' ); ?>
57 </p>
58
59
60 <h3><?php $this->e( 'Control login button display' ); ?></h3>
61 <p class="description">
62 <?php $this->e( 'By default, all login buttons of each services are displayed on both login screen and register screen. You can turn it off on admin screen. Besides it, you can controll it with filter hook.' ); ?>
63 </p>
64
65 <pre class="brush: php">
66 <?php
67 $code = <<<EOS
68 /**
69 * This function determines whether buttons will be displayed.
70 *
71 * @param boolean \$display If true, buttons will be display
72 * @param string \$context 'login' or 'register'.
73 * @return boolean Don't forget to return true or false.
74 */
75 function _my_login_button_condition(\$display, \$context){
76 // Use switch statement is good practice.
77 // Because \$context may got more options.
78 switch(\$context){
79 case 'register':
80 // You don't like to display on registeration.
81 return false;
82 break;
83 default:
84 // Otherwise, returns as it is.
85 return \$display;
86 break;
87 }
88 }
89
90 //Add filter on display condition of buttons
91 //You will get 2 arguments, the 1st is display flag and another is context string.
92 add_filter('gianism_show_button_on_login', '_my_login_button_condition', 10, 2);
93 EOS;
94 echo esc_html( $code );
95 ?>
96 </pre>
97
98
99 <h3><?php $this->e( 'Display login button as you like' ); ?></h3>
100 <p class="description">
101 <?php $this->e( 'You can display social login buttons anywhere.' ); ?>
102 </p>
103 <p>
104 <?php $this->e( 'Gianism displays social login button on login screen. But you may want to display in other situations.' ); ?>
105 <br/>
106 <?php $this->e( 'For example, you have some SNS oriented site and want to hide WordPress\'s login screen and want your user to log in only through social login buttons.' ); ?>
107 <br/>
108 <?php $this->e( 'In this case, you can display social login buttons wherever you like. The &quot;if&quot; statement is not necessary if you are brave.' ); ?>
109 <br/>
110 </p>
111 <pre class="brush: php">
112 <?php
113 $code = <<<EOS
114 if( function_exists('gianism_login') ){
115 gianism_login();
116 }
117 EOS;
118 echo esc_html( $code );
119 ?>
120 </pre>
121
122 <p>
123 <?php $this->e( 'Further more, you might think your user should be redirect to your single page. In this case, you can specify redirect URL.' ); ?>
124 <br/>
125 </p>
126
127 <pre class="brush: php">
128 <?php
129 $code = <<<EOS
130 gianism_login('', '', get_permalink());
131 EOS;
132 echo esc_html( $code );
133 ?>
134 </pre>
135
136 <p>
137 <?php $this->e( 'First argument is starting tag(e.g. &lt;div id="some-id"&gt;). Second argument is closing tag(e.g. &lt;/div&gt;). And third argument is redirect URL where your user will be redirected after logging-in.' ); ?>
138 </p>
139
140 <h3><?php $this->e( 'Data Source' ); ?></h3>
141 <p>
142 <?php
143 printf(
144 $this->_( 'For more detailed information, please visit our <a target="_blank" href="%s">support site</a>.' ),
145 gianism_utm_link(
146 'https://gianism.info/',
147 [
148 'utm_medium' => 'customize',
149 ]
150 )
151 );
152 ?>
153 </p>
154