Skip to main content
added 49 characters in body
Source Link
EnexoOnoma
  • 221
  • 3
  • 6
  • 16

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see. Author will use those forms to post their content.

As far as I know, I can have a different template for those types with the if in category function but I am interested in alternative solutions (maybe better). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$pid = wp_insert_post($new_post);
$link = get_permalink( $pid );
echo $link;
wp_redirect( $link );

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see. Author will use those forms to post their content.

As far as I know, I can have a different template for those types with the if in category function but I am interested in alternative solutions (maybe better). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$link = get_permalink( $pid );
wp_redirect( $link );

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see. Author will use those forms to post their content.

As far as I know, I can have a different template for those types with the if in category function but I am interested in alternative solutions (maybe better). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$pid = wp_insert_post($new_post);
$link = get_permalink( $pid );
echo $link;
wp_redirect( $link );
added 131 characters in body
Source Link
EnexoOnoma
  • 221
  • 3
  • 6
  • 16

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see. Author will use those forms to post their content.

As far as I know, I can solve my problem with associatinghave a single.phpdifferent template for those types with every differet categorythe if in category function but I am looking for ainterested in alternative solutions (maybe better solution). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$link = get_permalink( $pid );
wp_redirect( $link );

What I want to do is to create a simple front-end form for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see.

As far as I know, I can solve my problem with associating a single.php template with every differet category but I am looking for a better solution. I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below).

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$link = get_permalink( $pid );
wp_redirect( $link );

What I want to do is to create a simple front-end post submit form, for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see. Author will use those forms to post their content.

As far as I know, I can have a different template for those types with the if in category function but I am interested in alternative solutions (maybe better). I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below). For your concern, I can not echo the $link .

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$link = get_permalink( $pid );
wp_redirect( $link );
Source Link
EnexoOnoma
  • 221
  • 3
  • 6
  • 16

How can I correctly redirect user to the submitted post and define a template for each new post in Wordpress?

What I want to do is to create a simple front-end form for every different type of post I will include in my Wordpress app. For example there will be articles, events, quick messages and those types will have a different design/structure for a user to see.

As far as I know, I can solve my problem with associating a single.php template with every differet category but I am looking for a better solution. I know that there is page_template to add in the array http://wpengineer.com/1229/puplishing-extend-of-wordpress/ but is there anything else?

Also I am having some difficulties to redirect or even echo the posted link (as below).

Thank you for your help.

if(isset($_POST['submit'])){

    global $user_ID;

    $new_post = array(
        'post_title' => $_POST['post_title'],
        'post_content' => $_POST['post'],
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);
}

I tried this for redirect without luck

$link = get_permalink( $pid );
wp_redirect( $link );