Posts 2 Posts
[resolved] Limit connection type by template via from_query_vars (3 posts)

  1. jtredway
    Posted 4 years ago #

    First of all, this plugin rocks!

    Second, is it possible to restrict a connection type via "from_query_vars" wherein the "meta_key" is "_wp_page_template"?

    For example, is something like the following possible:

    p2p_register_connection_type( array(
    		'id' => 'landing2page',
    		'from' => 'page',
    		'from_query_vars' => array(
    			'meta_key' => '_wp_page_template',
    			'meta_value' => 'template-landing-list.php'
    		'to' => 'page',
    		'title' => 'Show Which Pages?'
    	) );

    In the above example, I'm trying to get the connection box to only appear on the admin screen for pages which have been assigned a specific template?


  2. scribu
    Plugin Author

    Posted 4 years ago #

    That would mean that the box won't show up when you go to create a new page, since it won't have a template assigned to it until it's saved.

  3. jtredway
    Posted 4 years ago #

    I went ahead and added some JavaScript to hide/show the connection box on the fly whenever the the template is selected or previously assigned.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Posts 2 Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic