Viewing 15 replies - 1 through 15 (of 33 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Some code has changed, yes, so it should now be easier to integrate your own extensions in the plugin.

    The other thread got closed, and I did not manage to get reopened by a moderator, but can you provide me the code in here?

    Thread Starter herold

    (@herold)

    Here is the pods module (pods.php), however I have not got it to work yet. Need a bit help from you.

    <?php
    /**
     * @package Content Aware Sidebars
     * @author Joachim Jensen <[email protected]>
     */
    
    /**
     *
     * Pods Module
     *
     * Detects if current content is:
     * a) any or specific pods pages
     *
     */
    class CASModule_pods extends CASModule {
    
    	/**
    	 * Constructor
    	 */
    	public function __construct() {
    		parent::__construct('pods',__('Pods Pages',ContentAwareSidebars::DOMAIN));
    		$this->type_display = false;
    		//$this->id = 'pods';
    	}
    
    	/**
    	 * Get pods pages
    	 * @return array
    	 */
    	protected function _get_content($args = array()) {
    		if (function_exists('pods_api')) {
    
        		// Get PodsAPI
        		$api = pods_api();
    
    		    // Get Pod Pages
        		$pod_pages = $api->load_pages();
    
    		    $pod_page_list = array();
    
    		    foreach ( $pod_pages as $pod_page ) {
            		$pod_page_list[$pod_page[ 'slug' ]] = $pod_page[ 'name' ];
        		}
    		}
    
    		return $pod_page_list;
    	}
    
    	//public function db_where() {
    
    		//$pods_name = pods_url_variable('first', uri);
    		//return "(pods.meta_value IS NULL OR pods.meta_value = '".$pods_name."')";
    		//return is_pod_page($pod_page[ 'slug' ]);
    	//}
    
    	public function in_context() {
    		return is_pod_page();
    	}
    
    	public function get_context_data() {
    
    		$val = 'principle';
    		//$pod_page = is_pod_page();
    		//return $pod_page;
    		return array($val);
    	}
    
    }
    Thread Starter herold

    (@herold)

    It does list the pod pages correctly in the left menu sidebar.

    Thread Starter herold

    (@herold)

    I don’t understand why it won’t work if I select a WordPress page template. I created one that displays the content of my Pods.

    Thread Starter herold

    (@herold)

    By the way with the former plugin version I never used this part of the code you supplied in the old thread.

    add_filter('cas-module-pre-deploy','add_pods_to_cas');
    function add_pods_to_cas($modules) {
    $modules['pods'] = true;
    return $modules;
    }

    Plugin Author Joachim Jensen

    (@intoxstudio)

    I will look into it. There are some hardcoded strings in the code, is it not possible to get those dynamically?

    The last piece of code will register the module if content-aware-sidebars.php has not been altered to include it itself.

    What are your exact settings for the sidebar with the page template condition?

    Thread Starter herold

    (@herold)

    Basically I only select the WordPress page template and then replace the main sidebar, as I do with all other sidebars I have.

    What hard-coded strings you are referring too? Some of them are just for testing…

    Thread Starter herold

    (@herold)

    Let me know what you need from me in terms of testing other anything else. Do you have pods installed to do some tests?

    Please have in mind that the new module is only for ‘Advanced Content Types’, Custom Post Types already work with your plugin.

    Thread Starter herold

    (@herold)

    I guess the pods template detection is not working because it is not associated with a WordPress post or page. So, this needs some extra logic to work.

    Thread Starter herold

    (@herold)

    Where in the module is the logic that decides if the current condition is matched? Trying to understand your plugin so I can be of help…

    Plugin Author Joachim Jensen

    (@intoxstudio)

    I have Pods installed and played a little with it, but I have not yet had time to do any tests.

    in_context(): bool determines if the page being displayed is relevant for the module. get_context_data(): array|string should get the relevant data from the page, i.e. which advanced content type is being displayed.

    Thread Starter herold

    (@herold)

    Do get the test going do the following:

    – create a new Pods (ACT) – separate table
    – create a simple Pods page

    Thread Starter herold

    (@herold)

    What function in the plugin tests for the condition? For example if I have a pods page with the name ‘Test’ where will the plugin check if that condition is true.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    You should look in modules/abstract.php, but usually it should not be a concern – all that has to be done is to make get_context_data() return an array that contains the slug of the current pods page, e.g. array('test').

    Thread Starter herold

    (@herold)

    Ok, that’s helpful. Will do some more tests today.

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘Extension for Pod Pages and Templates’ is closed to new replies.