[Solved] Restricting users to a specific front end page [closed]

You’d have to add a function during the init action of WP. There you’ll get the current user and check whether they have a specific role assigned to them and redirect to the page when they do. add_action(‘init’, function () { $user = wp_get_current_user(); $role=”your role”; if (in_array($role, $user->roles)) { wp_redirect(‘url’); } }); WordPress Function … Read more

[Solved] WooCommerce Checkout page customization [closed]

To add the product image to the checkout review order page, you want to add the following into your functions.php file of your theme. function my_add_order_review_product_image( $product, $product_obj ) { $image = wp_get_attachment_image( get_post_thumbnail_id( $product_obj->post->ID ), ‘shop_thumbnail’ ); return $image . $product; } add_filter( ‘woocommerce_checkout_product_title’, ‘my_add_order_review_product_image’, 10, 2 ); This is utilizing the filter hook … Read more

[Solved] How to add nofollow on all external links without plugin?

This is how I would do it : 1/ create a filter to access the post content before it’s displayed on page. See http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2/ Inside your fonction called (ie : my_the_content_filter in the example from the Codex) adapt this code : https://stackoverflow.com/questions/5037592/how-to-add-rel-nofollow-to-links-with-preg-replace Cheers ! 1 solved How to add nofollow on all external links … Read more

[Solved] Template for custom post type shows all posts instead of just one

If the code for the ‘actual template’ you posted is in the single-people.php… you do not need any query at all! When you call the url mysite.com/people/firstname-lastname wordpress already know that you want to view that person, only search for a file that display it. Normally, wordpress, in this case, search for the file single-people.php … Read more

[Solved] Dynamic HTML not displaying at respective place

You’re getting the output there because dynamic_sidebar() displays/echoes the output (widgets in the specific sidebar), so the output is echoed right when the shortcode function is called, which is before the $data is actually echoed. And you can fix that using output buffering: Either append the output to $data: $data.='</div>’; $data.='<div class=”col-xl-4 col-lg-4 col-md-4 col-sm-12 … Read more

[Solved] Meteor Slides as header only for homepage and Use featured image of each page as header for respective pages

I have got answer for it. I have changed the code to add meteor slides plugin in functions.php to show the slideshow just in the homepage. <?php if ( is_front_page() ) { if ( function_exists( ‘meteor_slideshow’ ) ) { meteor_slideshow(); } } ?> After that i used a plug called WP display header to set … Read more

[Solved] Plugin to install a plugin

You can take a look at TGM-Plugin-Activation plugin. It should give you good starting point. As written in the documentation: TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install and even automatically activate plugins in singular … Read more

[Solved] Between functions.php (theme), widgets, and plugins, which is loaded first?

The plugins are loaded right before theme (yes, I’ve been looking for excuse to use this): However it is wrong to think about either as point of code execution. For most cases everything should be hooked and executed no earlier than init hook. According to Codex widget registration with register_widget() should be hooked to widget_init. … Read more

[Solved] Uninstall, Activate, Deactivate a plugin: typical features & how-to

There are three different hooks. They trigger in the following cases: Uninstall Deactivation Activation How-to trigger functions safely during the scenarios The following shows the right ways to safely hook callback functions that get triggered during the mentioned actions. As you could use this code in a plugin that uses plain functions, a class or … Read more

[Solved] What’s the preferred method of writing AJAX-enabled plugins?

the “safer and cleaner” way would be to use admin-ajax.php that comes with wordpress and wp_ajax hook to call your processing function from your plugin file and use wp-nonce to check the integrity of the call. for example: your ajax JQuery call would be <script type=”text/javascript” > jQuery(document).ready(function($) { var data = { action: ‘ACTION_NAME’, … Read more