Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter plusless

    (@plusless)

    Thanks!

    I got it working with a class, for future reference here is how I did it:

    $platform_list = array(
       array('name' => 'Apple Music', 'slug' => 'apple_music')
       array('name' => 'Soundcloud', 'slug' => 'soundcloud'),
       array('name' => 'Spotify', 'slug' => 'spotify')
    );
    
    foreach($platform_list as $platform) {
       $variable = new platform_variable($platform);
    }
    
    class platform_variable {
       protected $slug, $name;
    
       function __construct($platform) {
          $this->slug = $platform['slug'];
          $this->name = $platform['name'];
    
          rank_math_register_var_replacement($this->slug, array(
                'name' => esc_html__($this->name, 'rank_math'),
                'description' => esc_html__('url for '.$this->name, 'rank_math'),
                'variable' => $this->slug,
                'example' => $this->my_callback_function()
             ),
             [ $this, 'my_callback_function' ]
          );
       }
    
       function my_callback_function() {
          $post_id = get_the_ID();
          $metadata = get_post_meta($post_id, $this->slug, true);
    
          if (!empty($metadata)) {
             return esc_attr($metadata);
          } else {
             return null;
          }
       }
    }
    Thread Starter plusless

    (@plusless)

    Thanks @bcworkz for your help, I got it to work:

    add_filter('gettext', 'changeTaxonomyLabels');
    function changeTaxonomyLabels($translated_text) {
    	global $taxonomy;
    
    	if (is_admin() && $taxonomy == 'artists') {
    		switch ($translated_text) {
    			case 'The description is not prominent by default; however, some themes may show it.':
    				$translated_text = __('A short description about the artist.');
    				break;
    		}
    	} return $translated_text;
    }

    How to function works:
    First off we get the global $taxonomy variable, so we can check it later. Then we make sure that the current user is an admin, and that the current page is one of our taxonomy (which is called artists). We replace the default text (the case) with our custom text (‘A short description about the artist’) by changing the $translated_text variable. And finally, return the updated variable.

    Thread Starter plusless

    (@plusless)

    Hi all,

    It seems to be working right now, all episodes are now showing in iTunes.
    A few days back we changed the ‘Syndication feeds show the most recent’ setting inside WordPress (as discussed here), but it didn’t seem to solve the problem in iTunes whitin a few hours. I think iTunes took a bit longer than expected to update, and changing the ‘Syndication feeds show..’ setting did solve the problem.

    Thanks @lootahpaytah for your help!

    Thread Starter plusless

    (@plusless)

    Thanks @lootahpaytah for your response,

    The url of the feed is: http://www.noxu-recordings.com/feed/podcast
    And the link to the website is: http://www.noxu-recordings.com/

    Thread Starter plusless

    (@plusless)

    Thanks, thats an great idea!

    I tried to write the code, but I can’t seem to figure out how to make it work. Does anybody have an idea what I’m doing wrong?

    What I’ve got right now:

    function check_gender_tax($post_id) {
    		if (!isset( $_POST['meta_gender_nonce'] ) || !wp_verify_nonce( $_POST['meta_gender_nonce'], basename( __FILE__ ) ) ){
    			return;
    		}
    
    		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    			return;
    		}
    
    		if (!current_user_can( 'edit_post', $post_id ) ){
    			return;
    		}
    
    		if (!isset($_POST['tax_input']['gender'])) {
    			wp_delete_object_term_relationships($post_id, 'gender');
    		}
    	}
    
    	add_action('save_post', 'check_gender_tax');

    (I’ve also changed the ‘name’ of the checkboxes back to tax_input[gender][])

Viewing 5 replies - 1 through 5 (of 5 total)