Support » Plugin: Multiple Domain Mapping on Single Site » Setting by page type

  • WebFR


    I modified the old version of the plugin as follows: all “post” records worked automatically (If == post => Simply supplemented the list of manual settings with the list of posts, everything worked automatically.
    After updating the plugin all the code has changed, tell me how to do it most simply. You may decide to add this function to the plugin for other types of records at the user’s choice.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author matthias.wagner


    i do not really understand what you try to achieve or how you had it set up with the old version. could you please explain in more detail?
    just narrow down the functionality to only some post types? or page templates? or did you have some wildcard-subdomain functionality??




    All posts worked as subdomains. The list of published posts was loaded, expanding the “manual list” in the plugin settings. Attached a link to the modified version:
    Old modified version

    $siteurl = get_option("siteurl");//the address of the main page of WordPress site
    $url_info = parse_url($siteurl);//get all the components of the url: scheme and host
    //get all published posts
    $query = new WP_Query;
    $posts = $query->query
    		'posts_per_page' => -1
    $falke_mdm_domains_posts = array();//domains that are automatically generated from titles of posts
    foreach ($posts as $post)//go through all the posts, and add to the list of their respective subdomains and source URLs
        $domain = $url_info['scheme'].'://'.$post->post_name.'.'.$url_info['host'];
        //save domains in a separate array,
        // which are automatically generated from post titles are automatically generated from titles of posts
        //this is necessary to exclude them later when saving to the database,
        //to not display them in the form of saving domains-URLs
        $falke_mdm_domains_posts[] = $domain;
        //also add these domains to the General list of domains,
        //which contains also the domains are taken from plugin settings
        $falke_mdm_domains[] = $domain;
        $falke_mdm_destinations[] = '/'.$post->post_name;


    require 'multidomainmapping_alter.php'; // 111 line
    global $falke_mdm_domains_posts; if (in_array($v,$falke_mdm_domains_posts)) continue; // 433 line
    • This reply was modified 1 year, 1 month ago by WebFR.
    Plugin Author matthias.wagner



    ah ok, i understand 🙂
    one of our goals for the new version was to help developers build their own solutions on top of the plugin. that is why we introdoced actions and filters. for your case, you should work with the filter “falke_mdmf_save_mappings” which is called before the array of mappings is stored in the database. this will save your post mappings permanently – unfortunately we did not yet set a filter when they are read out from the database…

    so in your functions.php or plugin-file you could use an action on post save (so that it is triggered each time a post is saved/edited) and call the filter there to use your logic to append the altered post to the array.

    we will introduce another filter in the next version which is called when loading the mappings, so that you would not have to save all the post-mappings if you don’t like that 😉

    see the faq for information about our actions and filters:

    good luck for that

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting by page type’ is closed to new replies.