Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Resolved] Bug? Cred Child Content Link not actually creating child content

$
0
0

Still 774.

Here's the functions.php

<?php
/**
 * FUNCTIONS / THEME INITIALIZATION
 *
 * This file loads the core framework which handles everything.
 *
 * @package     PageLines Framework
 * @since       1.0
 *
 * @link        http://www.pagelines.com/
 * @link        http://www.pagelines.com/DMS
 *
 * @author      PageLines   http://www.pagelines.com/
 * @copyright   Copyright (c) 2008-2012, PageLines  hello@pagelines.com
 *
 * @internal    last revised January 20, 2012
 * @version     ...
 *
 * @todo Define version
 */

require_once(get_template_directory() . '/includes/init.php');

add_action('cred_save_data', 'my_cred_save_data_action',10,2);
function my_cred_save_data_action($post_id, $form_data){
    // if a specific form
    if ($form_data['id']==774){
        if (!empty($_GET['parent_YOUR_CUSTOM_POST_SLUG_id'])) {
            $parent_YOUR_CUSTOM_POST_SLUG_id = intval($_GET['parent_YOUR_CUSTOM_POST_SLUG_id']);
            add_post_meta($post_id, '_wpcf_belongs_YOUR_CUSTOM_POST_SLUG_id', $parent_YOUR_CUSTOM_POST_SLUG_id, true);
        }
    }
}

And the Cred form content…

[credform class="cred-form cred-keep-original"]

	[cred_field field="form_messages" value=""]

	<div class="cred-field cred-field-post_title">
		<div class="cred-label">Topic Name</div>
		[cred_field field="post_title" post="topic" value="" urlparam=""]
	</div>
	<div class="cred-field cred-field-post_content">
		<div class="cred-label">Topic Description</div>
		[cred_field field="post_content" post="topic" value="" urlparam=""]
	</div>

	<div class="cred-group cred-group-taxonomies">
		<div class="cred-taxonomy cred-taxonomy-topic-tag">
			<div class="cred-label"><h2>Topic Tags</h2></div>
			[cred_field field="topic-tag"]
			<div class="cred-taxonomy-auxilliary cred-taxonomy-auxilliary-topic-tag_popular">
				[cred_field field="topic-tag_popular" taxonomy="topic-tag" type="show_popular"]
			</div>
		</div>
		
	</div>

	[cred_field field="form_submit" value="Submit" urlparam=""]

[/credform]

Viewing all articles
Browse latest Browse all 20145

Trending Articles