Get URL from shortcode tag

There’s no need to use regex for this. WordPress has a Shortcode API to do this work for you. That codex page includes one of my favorite codex code snippets: function bartag_func( $atts ) { extract( shortcode_atts( array( ‘foo’ => ‘something’, ‘bar’ => ‘something else’, ), $atts ) ); … Right at the start of … Read more

Limit checklist by the current user

Use the same technique as $checked: $disabled = ( $ed->ID != get_current_user_id() ) ? ‘ disabled=”disabled”‘ : ”; your code: foreach ($alleds as $ed) { $checked = (in_array($ed->ID,(array)$currenteds)) ? ‘ checked=”checked”‘ : ”; $disabled = ( $ed->ID != get_current_user_id() ) ? ‘ disabled=”disabled”‘ : ”; echo ‘<input type=”checkbox” name=”currenteds[]” value=”‘ . $ed->ID . ‘”‘ . … Read more

Add additional field to custom post_type

In your code, you are using: add_filter( ‘team_Meta_Box’, ‘team_sample_metaboxes’ ); On the site you linked to, they are using: add_filter( ‘cmb_meta_boxes’, ‘wpb_sample_metaboxes’ ); So my question is: did you change all instances of “cmb” to “team” in the init.php file? If you did, then the correct filter to use should be: add_filter( ‘team_meta_boxes’, ‘team_sample_metaboxes’ ); … Read more

WooCommerce Tabs [closed]

Yup, there’s a filter for it: woocommerce_settings_tabs_array: add_filter( ‘woocommerce_settings_tabs_array’, ‘wpse94969_settings_tabs_array’ ); function wpse94969_settings_tabs_array($tabs){ $tabs[‘catalog’] = __(‘Products’,’your_textdomain’); // or whatever you fancy return $tabs; } This will take care about the tab title itself: The word “Catalog” appears again in two field labels below though. To change these you can take advantage of the woocommerce_catalog_settings filter: … Read more

Where can I create a normal php file?

For example, I create a file: json.php, and I put it in the wp-content folder and try to acess it like that: www.example.com/json.php, but I get the error. That is because the path is wrong. If you put the file in your theme the path to the file is http://example.com/wp-content/themes/your-theme-name/your-file.php, not http://example.com/your-file.php. That path points … Read more

Pull Tags But Not as Links

You can use get_the_terms(). I’ve adapted the following from an example on that page: $terms = get_the_terms( $post->ID, ‘visits’ ); if ( $terms && ! is_wp_error( $terms ) ) : $visits_name = array(); foreach ( $terms as $term ) { $visits_name[] = $term->name; } $terms_list = join( “, “, $visits_name ); echo $terms_list; endif; EDIT: … Read more

Fatal Errors on pluggable.php

Don’t mess around with changing those files directly. It will break when that file gets changed in an update. Do this instead. add_filter( ‘wp_mail_from’, ‘override_mail_from_address’ ); add_filter( ‘wp_mail_from_name’, ‘override_mail_from_name’ ); function override_mail_from_address($email_address) { $from_array = explode(‘@’, $email_address); $from_address = $from_array[0]; $from_domain = $from_array[1]; if (strtolower($from_address) == ‘wordpress’) { $from_address = “myname”; /* Put the email … Read more

Class variables not correct on page

When you write that code <?php $pageopi = new opi; ?> // 1. object created // 2. __construct is called // 3. init action hook is set but is never executed so is o_check method <?php echo $pageopi->mg; ?> At this stage, init hook was executed long time before $pageopi is created actually, when page … Read more