Please or Register to create posts and topics.

Neues Thema nach CPT entry

Liebe Leute,

 

ist es möglich,dass wenn ein cpt erstellt wird automatisch ein neues Thema in asgaros Forum erstellt wird?

 

Vielen Dank

Hey @mochkal,

eigentlich sollte automatisch ein Thema erstellt werden, wenn du unter “Forum” -> “Einstellungen” -> “Allgemein” -> “Erstelle Themen für neue Blog-Beiträge im folgenden Forum:” ein gewünschtes Forum eingestellt hast. Allerdings werden dann auch bei allen anderen Beiträgen immer ein Thema erstellt.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

Hey @qualmy91,

 

vorweg danke für deine Antwort.

Habe leider nur eine Option für Blogposts gefunden jedoch nicht für CPTs.

 

Eventuell eine Info wo man dies einstellen kann?

 

Vielen Dank

Sorry hab da eine Zeile im Code überlesen. Aktuell werden nur posts übernommen. Ich werde das vermutlich auch in mein Plugin “Toolbox for Asgaros Forum” mit aufnehmen, das wird aber noch ein bisschen dauern.

Hier ist mal ein Coden den du einfügen kannst um das zu handeln:

add_action('transition_post_status', 'create_toppic_for_cpt', 10, 3);


function create_toppic_for_cpt($new_status, $old_status, $post) {
    global $asgarosforum;

    if ($post->post_type == 'CPT_NAME' && $new_status == 'publish' && $old_status != 'publish') {

        $asgarosforum->create_blog_topic('FORUM_ID', $post);
    }
}

Ändere erstetze einfach CPT_NAME und FORUM_ID mit deinen eigenen Werten und dann wird dir bei jedem neuen CPT ein neues Topic aufgemacht.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

Das du der Beste bist brauche ich hoffentlich nicht erwähnen.

Tausend Dank dafür.

 

Schöne Woche wünsch ich dir

Kein Problem und dir auch einen guten Start in die Woche.

Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

@qualmy91

einmal muss ich dich bitte noch belästigen.

Würde die Möglichkeit bestehen, dass im Content vom Eintrag der Link zum CPT angezeigt wird?

Zur Zeit wird “nur” der Foreneintrag als Titel erstellt, jedoch ohne irgendetwas drinnen.

 

Vielen Dank

@mochkal

Versuch mal bitte folgenden code:

add_filter('asgarosforum_filter_automatic_topic_content', 'change_content_for_cpt', 10, 2);

function change_content_for_cpt ($post_content, $post){

    $permalink = get_permalink($post);

    $post_content .= '<br><br><a href="' . $permalink . '" target="_blank">Beitrag öffnen</a>';

    return $post_content;
}

Das sollte am Ende zwei neue Zeilen einfügen und den Text “Beitrag öffnen” als Link zum Beitrag. Wäre dann auch bei allen normalen Posts so, wenn du die Funktion aktiviert hast.

 

Asgaros has reacted to this post.
Asgaros
Need professional help with Asgaros Forum? Book an appointment with us at domra Web Solutions for setup and customization services. Learn more about our Toolbox for Asgaros Forum plugin to enhance your forum experience.

Klappt perfekt vielen lieben Dank 😉

qualmy91 has reacted to this post.
qualmy91