Forums

Question and Answer Forum
older posts... (7 posts)

  1. nikosgr
    Member
    Posted 6 months ago #

    Hi
    i have a question and answer page and i installed the plugin but it is not showing the previous questions (which are stored as posts)

    any ideas?
    thanks in advance!

    http://wordpress.org/extend/plugins/question-and-answer-forum/

  2. trevorpythag
    Member
    Posted 6 months ago #

    do you mean the previous questions aren't showing up in the plugin or in the whole website?

    To make them show up in the plugin you will need to change their post type to question. They should still show up on your website though.

  3. nikosgr
    Member
    Posted 6 months ago #

    hi!
    they are not showing in the plugin. How can i change their post type to question?

  4. trevorpythag
    Member
    Posted 6 months ago #

    The post type is just a field in the posts table of the wordpress database. If all your "posts" are actually "questions" you could use a script to change them all. I could write you one.

    Otherwise you'll have to manually go through the database to change them. To do this you you will some sort of program to allow you to edit your database directly. If you have webhosting then it is likely that the your host provides a program like phpMyAdmin. If you are working on a local development site you can use the my sql command line or something similar.

    Hope this helps.

  5. nikosgr
    Member
    Posted 6 months ago #

    if you can write a script, it will be fine. otherwise i will do it manualy through phpmyadmin!

    thanks again for your answer :)

  6. trevorpythag
    Member
    Posted 6 months ago #

    Something like the following should do. I haven't tested it though so there might be a bug or two.

    <?php
    include "wp-config.php";
    global $wpdb;
    $result = $wpdb->update("$wpdb->posts",							//table to update
    							array('post-type'=>'question'),			//change post type to question
    							array('post-type'=>'post')				//update all 'posts'
    							);
    if(!$result){
    	echo " there was an error";
    }
    else{
    	echo "$result posts were changed to questions";
    }
    
    ?>

    sorry about the delay

  7. trevorpythag
    Member
    Posted 6 months ago #

    PS you will need to place the code in a file with the .php extension in the root of your wordpress installation (the folder with wp-config.php in it).

Reply

You must log in to post.

About this Plugin

About this Topic