Support » Fixing WordPress » [Plugin: Custom Field Template] need help

  • Resolved Franz Josef Kaiser

    (@f-j-kaiser)


    Hi,

    i´ve got massive problems with using this problem (problems are not plugin-related… they are more likely sitting in front of the computer) and understanding the way it works.

    i tried to make a template with my custom fields to get some sort of contact-list. the i tried to bring them on a single post with using the short code for format.

    when i use the short code [ctf page_id=XY template=0] i can display a single contact/article. when i try to use [ctf format=1] to get all contacts/articles displayed, i get an error in row 1383(?): preg_replace() [function.preg-replace](…).

    my TEMPLATE #0:

    [Personen bezogene Daten]
    type = radio
    value = Frau # Herr
    default = Herr
    clearButton = true
    hideKey = true
    output = true
    
    [Vorname]
    type = text
    size = 35
    label = Vorname
    output = true
    
    [Nachname]
    type = text
    size = 35
    label = Nachname
    hideKey = true
    output = true
    
    [AkadTitel]
    type = text
    size = 35
    label = Akademischer Titel
    hideKey = true
    output = true
    
    [Funktionstitel]
    type = text
    size = 35
    label = Funktionstitel
    hideKey = true
    output = true
    
    [Position]
    type = text
    size = 35
    label = Position im KH/Verbund/Konzern
    hideKey = true
    output = true
    
    [Mobiltelefon]
    type = text
    size = 35
    label = Mobiltelefon
    hideKey = true
    output = true
    
    [E-Mail]
    type = text
    size = 35
    label = E-Mail Adresse
    hideKey = true
    output = true
    
    [Photo]
    type = textarea
    rows = 1
    cols = 1
    mediaButton = true
    label = den linken Button klicken um ein Photo hochzuladen
    output = true
    
    [Standort bezogene Daten]
    type = checkbox
    value = Innsbruck # Graz # Wien
    default = Innsbruck # Graz # Wien
    label = Teilnahme nach Standort
    output = true
    
    [Hotel Innsbruck]
    type = select
    value = Ibis Bahnhof # Autria Trend Congress # Whatever
    default =
    label = Hotel Innsbruck
    hideKey = true
    output = true
    
    [Hotel Graz]
    type = select
    value = Erzherzog Johann # Daniel # Whatever
    default =
    label = Hotel Graz
    hideKey = true
    output = true
    
    [Hotel Wien]
    type = select
    value = Austria Trend Hotel Albatros # Bellevue # Ibis Westbahnhof
    default =
    label = Hotel Wien
    hideKey = true
    output = true
    
    [Bustransfer]
    type = radio
    value = Ja # Nein
    default = Ja
    output = true
    label = Bustransfer
    hideKey = true
    clearButton = true
    output = true

    my FORMAT #1:

    <table class="cft">
    <tbody>
    <tr>
    <th rowspan="3">Personen bezogene Daten</th>
    </tr>
    <tr>Anrede
    <td rowspan="3">[Personen bezogene Daten]</td>
    </tr>
    <tr>
    <td>[AkadTitel],</td><td> [Vorname],</td><td> [Nachname]</td>
    </tr>
    <tr>
    <td>[Funktionstitel],</td><td> [Position]</td>
    </tr>
    <tr>
    <td>[Mobiltelefon]</td>
    </tr>
    <tr>
    <td>[E-Mail]</td>
    </tr>
    <tr>
    <th rowspan="3">Teilnahme nach Standort</th><td>[Standort bezogene Daten]</td>
    </tr>
    <tr>
    <th rowspan="3">Hotel nach Standort</th><td>[Hotel Innsbruck], </td><td>[Hotel Graz], </td><td>[Hotel Wien]</td>
    </tr>
    <tr>
    <td rowspan="2">Bustransfer</td><td>[Bustransfer]</td>
    </tr>
    </tbody>
    </table>

    i did a lot of try and error, but nothing worked. i think my problem is withhin the format=xy (according to try and error).

    i want to get #1) around the error message and #2) display all cutsom-fields in posts withhin a certain category as a table.

    is #2 possible? i simply don´t understand the short code [ctf format=xy], right?

    If you can lend a helping hand: Thanks a lot!

    http://wordpress.org/extend/plugins/custom-field-template/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I fixed this bug in the version 0.9.2. Please try to use it.

    [cft] has two display option. One is just a listing based on output = true like [cft template=1]. This is limited to a certain template. The default is template = 0. The other is based on the shortcode format like [cft format=1]. This is not limited to a certain template.

    If you set post_id in the shortcode like [cft post_id=3], the custom fields related to post_id=3 are displayed. If you do not specify the post_id like [cft], the custom fields of the current post will be shown.

    Do you want to show all custom fileds in posts within a certain category? You have to write some scripts with a loop. This is an example.

    <?php
    while (have_posts()) : the_post();
    echo $custom_field_template->output_custom_field_values(array('post_id' => $post->ID, 'format'=>1));
    endwhile;
    ?>

    ah. Horiaki, i´ve to excuse. i downgraded to 0.8 and saw it working, so i upgraded to 0.9.2 (again) and it was working too. i think it was a problem with the browser cache.

    EDIT: The Code you gave me is partly working. I get some of the keys of “format #2” a the end again (without / with empty values). it´s only regarding the titles (the stuff that´s not between “[]” ). the rest doesn´t show up.

    this is my template (without the template-comment on top of the file):

    <?php get_header(); ?>
    <?php query_posts('post_type=post&cat=15&order=asc'); ?>
    
    <div id="page">
    	<div id="slider">
    		<ul class="navigation">
    <?php while (have_posts()) : the_post(); ?>
    			<li><a href="#<?=$post->post_name?>"><span><?php the_title(); ?></span></a></li>
    <?php endwhile;?>
    		</ul>
    
    		<div class="scrollButtons scrollMeLeft"><a><span>previous</span></a></div>
    
    		<div class="scroll">
    			<div class="scrollContainer-aussteller">
    
    				<?php while (have_posts()) : the_post();
    				echo $custom_field_template->output_custom_field_values(array('post_id' => $post->ID, 'format'=>1));
    				endwhile; ?>
    
    				<div class="panel-aussteller" id="<?=$post->post_name?>">
    					<h3><?php the_title(); ?></h3>
    				</div>
    
    			</div>
    		</div>
    
    		<div class="scrollButtons scrollMeRight"><a><span>next</span></a></div>
    
    	</div>
    </div>

    Questions:
    #1) Is it possible to use the regular <table>-markup like: border, rowspan, colspan, colgroup, etc.?
    #2) Is it possible to use the regular <style>-markup like: width, height, background-color, and so on?
    #3) Do you see any possible error causing code-strings in my template? I added your code and left the “endwhile;” out, because i got the endwhile after the title in my original template-file

    Thanks for your fast answer and help in this case.

    @ Question #1 & #2: i want to use this in admin panel under custom field template options in format #xy

    for everyone other reading this: stop thinking in categories – “format” are in this case better than category, or even better: “format” is your category.

    Format is only for the frontend. You can not use [cft] shortcode format for the custom field template of post/page edit in admin panel. You can use any html tags and css in the [cft] shortcode format. CFT just do convert [key] to the value of [key]. If the value is empty, the value is blank. About your code, the loop seems to be redundant but I do not have time to check it now. Sorry….

    Hi Hiroaki,
    the question was about [ctf] short code format for displaying the list in a page/post.
    About my code: query: get Posts from Cat; 1st while have posts: posts-menu per page; 2nd while have posts: for displaying the cft-data tables.

    Question #1: it seems that the stylesheet of the ctf is overriding parts of my themes stylesheet. Is this possible?
    Question #2: Something strange is happening with the table-format. Cells are pretty mixed-up and stuff, that should be on top with the table is downside and other stuff. Ever found something similar happening?

    In every case: Thanks for your help and the while-have-posts-string!

    Can you please put these instructions for this plug-in with the plugin? I really like it now that I got it working, but it took me several hours to figure out the proper short code formats. I finally found them on this post.

    Thanks!!

    [cft] has two display option. One is just a listing based on output = true like [cft template=1]. This is limited to a certain template. The default is template = 0. The other is based on the shortcode format like [cft format=1]. This is not limited to a certain template.

    If you set post_id in the shortcode like [cft post_id=3], the custom fields related to post_id=3 are displayed. If you do not specify the post_id like [cft], the custom fields of the current post will be shown.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Custom Field Template] need help’ is closed to new replies.