• I’m interested in creating having one custom field that will appear with every post.
    So, I’ve been trying to modify post.php so that instead of having to make two submissions to post, (‘Add Custom Field’ and then ‘Publish’) I can treat the custom field as just another text-box to fill.
    I’ve already putting it in just the extra code needed to create the form inputs, but there seems to be more to it than that.
    Any comments or pointers? What should I look into?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Did you find a solution for this? I’m interested in the same thing.

    Take a look at my LJ Extras plugin and see if that is what you are looking for (in general)

    Thread Starter RobotHero

    (@robothero)

    If I could get it to work, it would be. I activated LJ Extras, LJ Mood Icons, and LJ Music, and then I tried a couple of test posts. It wasn’t displaying anything, so I printed out the results of get_post_custom()
    Array
    (
    [unt_lj_entry] => Array
    (
    [0] =>
    )
    [unt_lj_journal] => Array
    (
    [0] =>
    )
    [unt_lj_mood] => Array
    (
    [0] =>
    )
    [unt_lj_moodid] => Array
    (
    [0] =>
    )
    [unt_lj_music] => Array
    (
    [0] =>
    )
    [unt_lj_synch] => Array
    (
    [0] =>
    )
    )

    So, while it is creating the keys, it isn’t correctly assigning them a value.

    Here is the code I use to get my custom data:
    $cur_mood = get_post_custom_values(‘unt_lj_mood’);
    $cur_mood = $cur_mood[0];

    Thread Starter RobotHero

    (@robothero)

    Okay. I’ve narrowed down the problem to this:
    $_POST is returning nothing. This could be because the version of PHP I’m running predates the introduction of $_POST.
    I’ve contacted my host to see if they are interested in updating it, and if not, I will try re-writing your plugin to use $HTTP_POST_VARS.

    Ahhhh, yeah $_POST not existing would be the problem, you are probably going to have to rewrite quite a bit if you want to use the HTTP ones. I am impressed that WordPress works at all since I know that it uses $_POST, $_GET and so on all over the place…

    Thread Starter RobotHero

    (@robothero)

    Well, my host says they are using version 4.3.7, and $_POST was introduced in version 4.1.0. Plus, some of the WordPress core files use $_POST, and it hasn’t caused me trouble before. So that’s shouldn’t be the problem.

    I cant activate plugin. This is error: Warning: get_lj_login_data(): Unable to access ../wp-includes/class-IXR.php in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89
    Warning: get_lj_login_data(../wp-includes/class-IXR.php): failed to open stream: No such file or directory in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89
    Fatal error: get_lj_login_data(): Failed opening required ‘../wp-includes/class-IXR.php’ (include_path=’.;c:\php4\pear’) in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Built-in custom field’ is closed to new replies.