Skip Navigation

[Resolved] Remove carriage return after comma for comma separated lists.

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by nealM 5 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1384541
2019-11-15_10-23-47.png

Tell us what you are trying to do? Remove carriage return in an column in an archive list

Is there any documentation that you are following? No.

Is there a similar example that we can see? See attached image

What is the link to your site? hidden link

#1385995

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Neal,

Thank you for getting in touch.

I must apologize for the delay in response as the forums are generally closed on the weekend.

Would you mind sending me a screenshot of the view that is used to generate this so that I can see how it was built?

Thanks,
Shane

#1386377
2019-11-18_15-54-00.png

Here is the Loop Editor. It's an archive with fields from a custom post"Commentaires de lecture".

#1387149

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Neal,

Thank you for the screenshot.

I'm assuming that your Auteur column is being displayed using the [nom-complet] shortcode correct?

Is this a custom shortcode that you created?

If so could you paste the code here so that I can have a look.

Thanks,
Shane

#1387297

Actually I did not make these shortcodes. I found them somewhere else and applied them here because the ones that we in use did not function anymore... so therefore [wpv-'s don't work here. Each custom post is up and running and works quit well. I just can't get them to work here (archives). My question is for applying quick patching but I realize there is a much bigger problem.

#1387315

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Neal,

Not sure how much I can help here because the issue seems to be coming from the custom shortcode.

Unfortunately this is custom code which isn't supported by our forums.

Would mind sending a link to where you got this custom shortcode from?

Thanks,
Shane

#1388933

Found it iin the Functions Theme file. Not the regular one, a special one called funnctions-nb.php

Here's the part that makes the shortcode. I can send you the whole file too....?

//Affichage prenom nom - Auteurs / Collaborateurs

function nom_complet_func( $atts, $postId = null, $startsWithFirstname = true) {

if ($postId == null) {
global $post;
$postId = $post->ID;
}

$type = 'aucun';
extract( shortcode_atts(
array(
'type' => $type,
),
$atts,
'nom-complet'
)
);

if ($type == 'auteur' && get_post_meta( $postId, 'wpcf-collectif', true))
{
$nomcomplet = __('Collectif');
}
else
{
$tableauNomsComplets = array();

$terms = get_the_terms( $postId, $type );

// This fixes some cases where terms wouldn't be retrieved with function above
if (is_wp_error($terms) || empty($terms) || !$terms) {
$terms = wp_get_post_terms( $postId, $type );
}

if ( $terms && !is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$idterm = $term->term_id;
if ($startsWithFirstname) {
$tableauNomsComplets[] = '' . trim(get_post_meta($idterm, 'wpcf-prenom', true) . ' ' . get_post_meta($idterm, 'wpcf-nom', true)) . '';
} else {
$tableauNomsComplets[] = '' . trim(get_post_meta($idterm, 'wpcf-nom', true) . ', ' . get_post_meta($idterm, 'wpcf-prenom', true)) . '';
}
}
}
if ($type == 'auteur' && get_post_meta( $postId, 'wpcf-sous-la-direction', true) == 1) {
$sousLaDirectionDe = __( 'Sous la direction de ' );
}
else if ($type == 'auteur' && get_post_meta( $postId, 'wpcf-presente-par', true) == 1) {
$sousLaDirectionDe = __('Présenté par ');
}
else {
$sousLaDirectionDe = '';
}

if ($startsWithFirstname) {
$nomcomplet = $sousLaDirectionDe . implode(', ', $tableauNomsComplets);
} else {
$nomcomplet = implode(', ', $tableauNomsComplets) . ($sousLaDirectionDe != '' ? ' (' . trim($sousLaDirectionDe) . ')' : '');
}
}

return $nomcomplet;
}
add_shortcode( 'nom-complet', 'nom_complet_func' );

#1389005

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Neal,

I've found the issue.

So your code is fine and isn't giving a carriage return. The problem is with the display: block that you have on the a tags.

This css here

div.objet-archive span a{
    display: block; 
}

What you can do is to replace it with this.

div.objet-archive span a{
    display: inline; 
}

Please let me know if this helps.
Thanks,
Shane

#1389439

Thanks! But in what file? Php archives files? Can't see it anywhere...

#1389549

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Neal,

What you can do instead of modifying the template files you can just add this css to the css section of your view.

div.objet-archive span a{
    display: inline !important; 
}

This should resolve the issue as well.
Thanks,
Shane

#1390101

My issue is resolved now. Thank you!