Stop SOPA!
What is this all about: Help Stop SOPA/PIPA
Turn off your website on January 18th for 12 hours.
Simple and fast solution for turn the website off; use the Plugin WP Maintenance Mode, original for the activation of the maintenance mode; but its easy for this requirement. As useful; the plugin send an 503 Service Unavailable header.
Set the following settings in the plugin

Code for the field text, the video markup:
<iframe src="http://player.vimeo.com/video/31100268?byline=0&portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <p><a href="http://vimeo.com/31100268">PROTECT IP / SOPA Breaks The Internet</a> from <a href="http://vimeo.com/fightforthefuture">Fight for the Future</a>.</p>
Here is the result for not signed in visitors:


© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read MoreStop SOPA!
What is this all about: Help Stop SOPA/PIPA
Turn off your website on January 18th for 12 hours.
Simple and fast solution for turn the website off; use the Plugin WP Maintenance Mode, original for the activation of the maintenance mode; but its easy for this requirement. As useful; the plugin send an 503 Service Unavailable header.
Set the following settings in the plugin

Code for the field text, the video markup:
<iframe src="http://player.vimeo.com/video/31100268?byline=0&portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <p><a href="http://vimeo.com/31100268">PROTECT IP / SOPA Breaks The Internet</a> from <a href="http://vimeo.com/fightforthefuture">Fight for the Future</a>.</p>
Here is the result for not signed in visitors:


© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read MoreBest Practice for Multilanguage WordPress Content? New Plugin!
Since the beginning of WordPress the desire to publish the content in different languages is huge. But the topic can quickly become complex, because not only the rendering of content in the form of text in different languages ??is an issue, we also have to take care of the meta data for content, for images that can be different depending on the language and the use of the admin interface in the preferred language. Thus, only a part would be covered depending on the requirements (ein Bsp. bei StackExchange) it would quickly become an project and WordPress would be just a “small” framework behind it. There are already many Plugins available, the different approaches – new tables in the system or separation of content for each language in a table entry to post, or other solutions.
All these solutions have their limitations, are inflexible and you go into a dependency that will be hard to get out and with each update of WordPress you have to check if the Plugin is still working or has any bugs with the new version. Therefore, I would suggest a solution that we use in our Inpsyde Team frequently for customers and maintained their strength in the flexibility, in extensibility and in its capacity to use the WordPress standard without changing the core or anything else. You can deactivate the Plugin at any time, you won’t lose anything, your website remains the same.

Why multilanuage?
- 2/3, if not even more, of the worldwide population speak another language
- Globale Aufstellung von Unternehmen
- Better distribution of content
- Service for the client
- Search Engine Optimization
The solution
WordPress Multi-site provides the solution already.
This makes the management of different instances, with similarities and differences, with the help of an installation possible. The exchange of data is possible via core functions, which get united and simplified via Plugin.
Advantages
- WordPress Core Functions
- No dependency to Plugins
- Independent to WordPress development*
- Control Themes, Plugins at a central place, use them decentralized
- Low maintenance
- Seperating languages in Backend/Frontend (user dependent)
- Complete mirrored or in every content form seperated
- Subdomains or Subdirectories
- de.example.com, example.com/de
- Seperate Domains via Domainmapping
- example.de, example.com
- Free in development in design and usability
- Optimization not only on frontend, also lang-attributes, SEO
Plugin
With all these requirements and benefits, we use a base that is available as a Plugin in the official repository of WordPress: Multilingual Press . The plugin provides several convenient tools to use Multisite for the implementation of multilingualism.
This plugin simplifies the identification of different blogs in the network to a language and linking to other blogs, so that when you publish the content in blog A, it will create a post as draft in blog B. Thus, the articles are in relation, the system knows this and with the help of some functions, it may be used in the frontend and backend.
The Plugin provides in the article or page the ability to see a meta box with the content of the linked data, in the simplest case as a translation aid. Similarly, there is a widget that simplifies the frontend to change. In each blog you can be make ??some adjustments, assigning a flag and language.
An outlook
We are in the midst of the development, which adds the extra help. For example a dashboard widget with the overview of article and all links, an extension of the mediathek to seperate global content across all blogs and independent content per blog. Similarly, there are helpers for updating existing installations. In addition there is the possibility to directly load the language in the backend, without the need of FTP/SSH and assign the languages accordingly??. We will also add the function to copy existing blogs with all the content and options if you want to.
Summary
WordPress Multisite provides the basis and with some adjustments, a clean, controlled solution exists for the use of WordPress in a multilingual environment. Now it’s up to you – use Multisite, Test the Plugin and give us a feedback, preferable on our repo on Github.
.
This was our last door of our Advent Calendar. We hope you enjoyed it!
We wish you a Merry Christmas and thanks a lot for reading our posts!

© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read MoreSeparate Logic From Output
Once HTML is defined within a function for output, the HTML will be separated from the logic! In this case the function is defined twice. A function contains only logic and values ??are returned only as return. The second function will contain HTML, test logic, loops or hooks and outputs values ??as echo. Ok, the smart asses will say MVC, yeah you right, but WordPress does not pursue a Consistent MVC pattern!
Why WordPress doesn’t follow MVC pattern consistently?
If we have a close look on WordPress, we can detect an MVC pattern. By separating the Themes (view) from the core (model) it gives the impression WordPress pursues an MVC pattern. But this patternn is found only in the frontend. Let’s take a closer look and we see that there is no such logic for the admin area. So, the view for the admin area has to be anchored somewhere in the core. We can also notice that in the core itself are lose SQL queries within PHP. Well, a general separation of view and logic is not equal MVC. An MVC-Pattern is principally composed of a sort of object-oriented programming paradigm, in WordPress, these can also be found occasionally, but we find much more procedural than object-oriented programming paradigms. Conclusion WordPress itself does not pursue a MVC pattern, but it is quite possible MVC principles, as we used in the following.
function get_some_foo() {
$my_foo = 'This is Foo!';
return $my_foo;
}
function some_foo() {
$foo = get_some_foo();
echo $foo;
}
Why is this useful? We want the function some_foo() returns a predefined output. In another template we want to change the default behavior of the function some_foo(). In order to effectively reflect both requirements, two functions are defined. The first function consists only the elementary logic and is only returned as return values??, it is always preceded by a get_.... The second function includes predefined information, which in turn can be HTML, test logic, loops, or a hook.
function get_some_foo() {
$foo_bar_array = array( 'Foo', 'Bar', 'FooBar', 'BarFoo' );
$foo_bar_array = apply_filters( 'some_foo_array', $foo_bar_array );
return $foo_bar_array ;
}
function some_foo() {
$foo_list = '<ul>';
foreach( get_some_foo() as $foo_key => $foo_value ){
$foo_list .= '<li>' . $foo_value . '</li>';
}
$foo_list .= '</ul>';
echo apply_filters( 'some_foo', $foo_list );
}
In the previous example in each of the two functions with the function apply_filters() the possibility will be created, to change returned values later as you desired. A manipulation can take place via the so-defined hooks some_foo_array or some_foo. Here is an example of how a possible manipulation can look with the two defined hooks.
In the next code example, we change an array $foo_bar_array and the HTML output. This involves the two hooks some_foo_array and some_foo, which were set with apply_filters('some_foo' .... With the function add_filter() filter functions for further processing in the global variable $wp_filter will be registered.
function get_my_some_foo( $foo_bar_array ) {
$foo_bar_array[ count( $foo_bar_array ) + 1 ] = 'FuuBoo';
return $foo_bar_array ;
}
function my_some_foo( $foo_list ) {
$foo_list = str_replace( 'ul', 'ol', $foo_list );
return $foo_list;
}
add_filter( 'some_foo_array', 'get_my_some_foo');
add_filter( 'some_foo', 'my_some_foo');
// do not forget, call some_foo()
some_foo();
Let’s look briefly what’s happening. What outputs some_foo() has without manipulation we see in the following example.
function get_some_foo() {
$foo_bar_array = array( 'Foo', 'Bar', 'FooBar', 'BarFoo' );
$foo_bar_array = apply_filters( 'some_foo_array', $foo_bar_array );
return $foo_bar_array ;
}
function some_foo() {
$foo_list = '<ul>';
foreach(get_some_foo() as $foo_key => $foo_value){
$foo_list .= '<li>' . $foo_value . '</li>';
}
$foo_list .= '</ul>';
echo apply_filters( 'some_foo', $foo_list );
}
?>
// output
<ul>
<li>Foo</li>
<li>Bar</li>
<li>FooBar</li>
<li>BarFoo</li>
</ul>
In the next example we use the functions defined in the hooks some_foo_array and some_foo to add the array another element to make the unordered list, an ordered list.
function get_my_some_foo( $foo_bar_array ) {
$foo_bar_array[ count( $foo_bar_array ) + 1 ] = 'FuuBoo';
return $foo_bar_array ;
}
function my_some_foo( $foo_list ) {
$foo_list = str_replace( 'ul', 'ol', $foo_list );
return $foo_list;
}
// register Hooks in the stack ($wp_filter)
add_filter( 'some_foo_array', 'get_my_some_foo');
add_filter( 'some_foo', 'my_some_foo');
?>
//output
<ol>
<li>Foo</li>
<li>Bar</li>
<li>FooBar</li>
<li>BarFoo</li>
<li>FuuBoo</li>
</ol>
How does add_filter and apply_filters work in the program flow?
Each hook which should be executed is registered with add_filter or add_action in the global variable $wp_filter. If the function apply_filters() is called, an appropriate filter function based on the transmitted variables will be searched in the $wp_filter, if this is registered with add_filter, the appropriate function will execute. Now values will be manipulated now and then passed back to apply_filters.
Let’s take our example from above, it looks like this.
<?php
// the default function
function get_some_foo() {
$foo_bar_array = array( 'Foo', 'Bar', 'FooBar', 'BarFoo' );
$foo_bar_array = apply_filters( 'some_foo_array', $foo_bar_array );
return $foo_bar_array ;
}
// the filter function
function get_my_some_foo( $foo_bar_array ) {
$foo_bar_array[ count( $foo_bar_array ) + 1 ] = 'FuuBoo';
return $foo_bar_array ;
}
// register function in $wp_filter
add_filter( 'some_foo_array', 'get_my_some_foo' );
?>
Without hook functionality the whole thing would look like the following. Although we have much less code, but this is not reusable.
<?php
//Das ist unsere default Funktion
function get_some_foo() {
$foo_bar_array = array( 'Foo', 'Bar', 'FooBar', 'BarFoo' );
$foo_bar_array[ count( $foo_bar_array ) + 1 ] = 'FuuBoo';
return $foo_bar_array ;
}
?>
Guest Post
René lives in Halle at Saale, he is married, has a daughter (8) and a dog (12). He is a professional media designer for digital and print media, with a flair for design and color combinations. He is a creative WordPress developer, designer and media consultant who always has a suitable solution. René is an instructor and member of the Examination Board of the Chamber of Halle/Dessau for the education of media designer for digital and print media.

© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read MoreAdding Custom Fields to WordPress User Profile
The user profile of WordPress can be fairly easily adapted to add your own values??. So you can add the necessary fields according to your requirements. Here is how you do it, we add a field for the address and the content will be stored in the database. Various hooks in WordPress make sure that you only have to worry about the fields.

The function to store the entries is fb_save_custom_user_profile_fields() and here it is important to check the rights of each active user, only if the rights are available, in this case for editing users (edit_user), then data may be stored.
The actual saving of data takes place via update_usermeta().
It can pass all kinds of fields of course, the input field is just an example. It is advisable to outsource the functions in a Plugin, an alternative is also the functions.php of the Theme, but is certainly not the best way.
Each function of the small sample was referred to two hooks. Because WordPress differentiate between editing of user profiles and update personal data. This is done using the constant IS_PROFILE_PAGE. On default this constant is on TRUE and so would the hooks show_user_profile and personal_options_update be enough to bring in new fields and save them. But this can vary depending on the installation and this way the admin cannot maintain these new fields. In particular, two more hooks are needed. Otherwise there might be many cases, where the admin has to maintain data which the user doesn’t even see in his profile.
function fb_add_custom_user_profile_fields( $user ) {
?>
<h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
<table class="form-table">
<tr>
<th>
<label for="address"><?php _e('Address', 'your_textdomain'); ?>
</label></th>
<td>
<input type="text" name="address" id="address" value="<?php echo esc_attr( get_the_author_meta( 'address', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e('Please enter your address.', 'your_textdomain'); ?></span>
</td>
</tr>
</table>
<?php }
function fb_save_custom_user_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return FALSE;
update_usermeta( $user_id, 'address', $_POST['address'] );
}
add_action( 'show_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields' );

© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read MoreAdding Custom Fields to WordPress User Profile
The user profile of WordPress can be fairly easily adapted to add your own values??. So you can add the necessary fields according to your requirements. Here is how you do it, we add a field for the address and the content will be stored in the database. Various hooks in WordPress make sure that you only have to worry about the fields.

The function to store the entries is fb_save_custom_user_profile_fields() and here it is important to check the rights of each active user, only if the rights are available, in this case for editing users (edit_user), then data may be stored.
The actual saving of data takes place via update_usermeta().
It can pass all kinds of fields of course, the input field is just an example. It is advisable to outsource the functions in a Plugin, an alternative is also the functions.php of the Theme, but is certainly not the best way.
Each function of the small sample was referred to two hooks. Because WordPress differentiate between editing of user profiles and update personal data. This is done using the constant IS_PROFILE_PAGE. On default this constant is on TRUE and so would the hooks show_user_profile and personal_options_update be enough to bring in new fields and save them. But this can vary depending on the installation and this way the admin cannot maintain these new fields. In particular, two more hooks are needed. Otherwise there might be many cases, where the admin has to maintain data which the user doesn’t even see in his profile.
function fb_add_custom_user_profile_fields( $user ) {
?>
<h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
<table class="form-table">
<tr>
<th>
<label for="address"><?php _e('Address', 'your_textdomain'); ?>
</label></th>
<td>
<input type="text" name="address" id="address" value="<?php echo esc_attr( get_the_author_meta( 'address', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e('Please enter your address.', 'your_textdomain'); ?></span>
</td>
</tr>
</table>
<?php }
function fb_save_custom_user_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return FALSE;
update_usermeta( $user_id, 'address', $_POST['address'] );
}
add_action( 'show_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields' );

© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)
More Info: Click here
Read More





