How to get shortcode working from custom meta field

You can do this by using ‘the_content’ filter. That way, WordPress will treat the content as it was came from the editor field and execute all the shortcodes: <?php $meta = get_post_meta($post->ID, ‘intSlider’, true); ?> <div id=”sliderWrap”> <div id=”slider” class=”floatLeft”> <? echo apply_filters(‘the_content’, $meta); ?> </div> </div> Just be careful because it will wrap the … Read more

Allowing for multiple template views on the Gallery Settings page when using the Visual Editor

It appears that the templates live in script form <script type=”text/html” id=”tmpl-my-custom-gallery-setting”> To render the above template would require wp.media.template(‘my-custom-gallery-setting’)(view) Since we’re replacing the template: logic then all we need to do is store a list of template IDs. if (!wp.media.gallery.templates) wp.media.gallery.templates = [‘gallery-settings’]; wp.media.gallery.templates.push(‘my-custom-gallery-setting’); Then loop through all available views wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({ template: … Read more

Integrating WordPress to my website, while keeping my own authentication system

WordPress’s authentication system is made up of pluggable functions, which means that you can write a plugin that has a function named, say, wp_authenticate(), and your site will use your wp_authenticate() function instead of the native WordPress one. Your comment about is_user_logged_in() (on your original post) is obviated by the fact that is_user_logged_in() calls the … Read more

opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);

I am not sure if there’s a native function for this, but a little regex might help the case: function open_links_in_new_tab($content){ $pattern = ‘/<a(.*?)?href=[\'”]?[\'”]?(.*?)?>/i’; $content = preg_replace_callback($pattern, function($m){ $tpl = array_shift($m); $hrf = isset($m[1]) ? $m[1] : null; if ( preg_match(‘/target=[\'”]?(.*?)[\'”]?/i’, $tpl) ) { return $tpl; } if ( trim($hrf) && 0 === strpos($hrf, ‘#’) … Read more

Enabling Sessions in WordPress 3.0

If you need to manually enable the session globally, use this in your functions.php (I included a line for manually setting a session variable as an example, not required): add_action(‘init’, ‘session_manager’); function session_manager() { if (!session_id()) { session_start(); } $_SESSION[‘foo’] = ‘bar’; } and if you wanted to manually clear the session on an event … Read more

Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive

Here’s two different solutions (editing the specifics for your use case): Doing a Redirect: 1.) At the top of your /wp-config.php file add the following: if ( is_yoursite_blogger_domain( $_SERVER[‘SERVER_NAME’] ) ) { $domain = str_replace( ‘www.’, ”, $_SERVER[‘SERVER_NAME’] ); define( ‘WP_SITEURL’, ‘http://’ . $domain ); define( ‘WP_HOME’, ‘http://’ . $domain ); } else if ( … Read more

Get custom post type by category in a page template

This is a version of a function I’m using in the framework I’m working on, with example html replacing another function that contains something like it. // Custom Loop function arrr_custom_loop( $r_type=”post”, $r_post_num, $r_tax = ‘category’, $r_terms=”featured” ) { $args = array( ‘showposts’ => $r_post_num, ‘tax_query’ => array( array( ‘post_type’ => $r_type, ‘taxonomy’ => $r_tax, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)