Forum Replies Created

Viewing 15 replies - 16 through 30 (of 54 total)
  • Thread Starter alexadark

    (@alexadark)

    I tried on 2 websites and it doesn;t work, this is really annoying, i am using a lot the complex field and with all the fields open it’s a real mess
    it would be really nice to have all the fields closed by default when you open a page
    and don’t understand why the tabbed doesn’;t work

    Thread Starter alexadark

    (@alexadark)

    i have updated all my tabbed to tabbed-vertical but it doesn’t work

    Thread Starter alexadark

    (@alexadark)

    yes i just found that seraching in the code, but it doesn’t work for me ??

    Thread Starter alexadark

    (@alexadark)

    Great!
    Thank you
    you should have this type of things in the doc, it would be super usefull

    Thread Starter alexadark

    (@alexadark)

    Hi,
    i have found the solution, and created a function to make it easier
    if it can be integrated into carbon fields it would be great

    function carbon_get_the_term_meta( $taxonomy = 'category', $field_name ) {
    	$term = get_query_var( $taxonomy );
    	$term = get_term_by( 'slug', $term, $taxonomy );
    	return carbon_get_term_meta( $term->term_id, $field_name );
    }
    Thread Starter alexadark

    (@alexadark)

    Great it works!
    But one thing i don’t understand is that if i don’t want to have wpautop for ex, and want to have a <br> tag to go to the next line, the br is not kept, so it makes the rich_text editor very difficult to use without applying these filters

    Thread Starter alexadark

    (@alexadark)

    Also, the shortcodes doesn’t work in the rich text ??

    Thread Starter alexadark

    (@alexadark)

    Can you please answer to that it;s really a problem
    if i want to for ex to write
    hello
    world
    i have to do that
    <div>hello</div>
    <div>world</div>
    if i put a br it doesn’t stay there
    and if i simply go to the next line it doesn’t do it
    in wordpress editor if i write
    hello
    world
    it will appear like that in the front end , not here

    Thread Starter alexadark

    (@alexadark)

    It works !

    Thread Starter alexadark

    (@alexadark)

    Thank you !
    i am going to try !

    Thread Starter alexadark

    (@alexadark)

    yes i have done that

    Thread Starter alexadark

    (@alexadark)

    Hi,
    yes but i don’t know how to do it…
    basically i have this structure
    `Container::make( ‘post_meta’, ‘layouts’ )
    ->show_on_post_type( ‘page’ )
    ->show_on_template( ‘builder-page.php’ )
    ->add_fields( array(
    Field::make( ‘complex’, ‘crb_block_layouts’ )
    /**
    * TEXT AREA
    */

    ->add_fields( ‘text_area’, array(
    //fields for text area
    ) )
    /**
    * SLIDER
    */
    ->add_fields( ‘slider’, array(
    //fields fore slider
    ))`

    then i have the functions to displays them in another files

    if for exemple i don’t want to activate the slider how can i write it ?
    because if i write a conditional arround it gives me a php error

    `Container::make( ‘post_meta’, ‘layouts’ )
    ->show_on_post_type( ‘page’ )
    ->show_on_template( ‘builder-page.php’ )
    ->add_fields( array(
    Field::make( ‘complex’, ‘crb_block_layouts’ )
    /**
    * TEXT AREA
    */

    ->add_fields( ‘text_area’, array(
    //fields for text area
    ) )
    if(//condition){
    /**
    * SLIDER
    */
    ->add_fields( ‘slider’, array(
    //fields fore slider
    ))
    }`

    but i don’t know how to write my condition, as i say it is a syntax problem

    it’s strange because normally the id is the value which is retrieved by default…
    look here : https://carbonfields.net/docs/fields-image/
    it says :” set_value_type($value_type)

    Set the type of the stored value. (defaults to id)

    You can also url to store the URL of the image instead of the ID.”

    ok, but why do you want to retreive the ID, when carbon fields give you the id by default with his image cf.
    it would be simpler to not have the url option (unless you want only the url)
    and get the url with : wp_get_attachement_image_url
    that is in case you need to have classes to the image like me
    if not you can use wp_get_attachement_image and it outputs all the img code (try it, i have tried all these functions to see what they where doing, i use phpstorm, so when i begin to write theme all it list them all)

    I have also found this very useful function (which is not in wp, so i add it to my helper functions)

    /**
     * Retrieve parameters from attachments
     *
     * @since 1.0.0
     *
     * @param $attachment_id
     *
     * @return array
     */
    function wp_get_attachment( $attachment_id ) {
    
    	$attachment = get_post( $attachment_id );
    
    	return array(
    		'alt'         => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
    		'caption'     => $attachment->post_excerpt,
    		'description' => $attachment->post_content,
    		'href'         => get_permalink( $attachment->ID ),
    		'src'         => $attachment->guid,
    		'title'       => $attachment->post_title
    	);
    }

    in case you need the title, the caption etc…
    the ‘src’ is the url

    Hi Dewy, i have just done it too.
    personally i prefer to define an image size in my functions and choose this image size
    in this case don’t choose set_value_type(‘url’)
    then you can use wp_get_attachement_image_url($id,$image_size)
    and you can have another cf for the image size
    i think it also work with wp_get_attachement_image + it displays also the height and width
    i have not used it because i was needing an additional class

    Hope it helps

Viewing 15 replies - 16 through 30 (of 54 total)