Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #731143

    I have set up my blogpost by using the advanced layout editor to build my own blog layout.

    Question 1:
    I have used the Avia layout builder/content elements/blogspost to show our recent blogs. I would like to delete the showing of the category that is between the image and the title but have not found that option in the content element.

    Question 2:
    I would like to have the category of that blog show in the actual blog itself but do not know how to add it there, have not found the option to do so. I do not want to use the breadcrumb in the header/title bar as it is too large for nice viewing on mobile (title and breadcrumb overlap, and i ONLY want to show the category, not the whole path of where we are in the website as that still is not clear what the category is). i think i could do this by adding code in the actual post in a simple text content element that i can place in the third column at the bottom (showing the date of the blog), if so, can you please provide me with the code for it

    #731378

    Hey kitty,

    1. Please try the following in Quick CSS under Enfold->General Styling:

    .page-id-121 span.blog-categories {
      display:none !important;
    }

    2. I’m not sure I understand exactly what you mean, I can’t see any breadcrumbs on the page? Not sure what you are looking to achieve with the categories you mentioned either?

    Best regards,
    Rikard

    #731516

    That first one worked great, thank you!

    My second question. If i am in one of the blogs, nowhere does it show the category of that blog. I want it to show on the blog itself. So what CSS can i use that the blog itself shows the category of that specific blog. I want to add it using the content element Code Block that i have added to the post itself. I have searched for the correct css but have not found the correct code that will make it show.

    my mentioning of the breadcrumbs: if you add that then the category is one of the parts that show. I do not want the breadcrumb because it shows the full path where someone is and that is to much text. If there is code that can change the breadcrumb into showing only the category, that would be fine too (but only for the blog posts!)

    #731873

    Hi,

    Ok, thanks for the feedback. Did you check your settings under Enfold->Blog Layout to make sure what you have selected to show categories?

    Best regards,
    Rikard

    #732054

    Yes i have a lot ticked, including the categories. However they do not show in my blog post themselves at all. See a screenshot of my settings in the first dropboxlink below.

    The second dropboxllink shows where i would want to add the category if i have to use css to add it (in the layout i have already added the Code Block for it). If somehow it can be added with the right settings, i will be fine with that.

    Tnx for the support and answers (y), this just really baffles me….

    #733747

    I still need help getting the category of the blog to show on the actual blog itself. Even though i have ticked what i think needs to be ticked, no info is showing on the actual blog post. What do i need to do to get it to show?

    #733852

    Hi,

    Are you using the advance layout builder for the post? The elements such as the category, post title and other default post elements will not be included in the template if you’re using the advance layout builder.

    Best regards,
    Ismael

    #733996

    Yes i am using the advanced layout editor. So what code do i need to add to enable WP/Enfold to show the category? If it is showing in the non-advanced layout editor, there is code for it. I have searched a lot, but have not found anything that works yet.

    #734493

    Hi,

    Could you try simply saving the post with the default editor active please? That should bring in all the “default” elements.

    Best regards,
    Rikard

    #734650

    I tried saving in the default editor. The only thing that shows then is all the default elements but my entire blog itself is no longer showing. So that is not a solution.

    How is that default catogory and tags added (what code is used) so that i can try to add that into my code block in the advanced layout editor?

    #736192

    Hi,

    You can create a custom shortcode for the categories. Add the following code in the functions.php file.

    function custom_categories_shortcode() {
    	global $post;
    	ob_start();
        	the_terms( $post->ID, 'category', '<strong>Categories: </strong>', ' , ' ); 
    
    	$output = ob_get_clean();
        return $output;
    }
    add_shortcode('the_post_categories', 'custom_categories_shortcode');

    Edit the post, insert a text or codeblock then use the following shortcode:

    [the_post_categories]
    

    More info here:

    // https://kriesi.at/support/topic/question-about-transferring-set-up-to-our-actual-site/#post-643745

    Best regards,
    Ismael

    #736415

    i added the code, this is what i got next when i tried to use the website:
    Parse error: syntax error, unexpected ‘&’ in /home/fin-planning.nl/public_html/offermansvangemert.nl/wp-content/themes/enfold/functions.php on line 578
    i managed to get into the functions file and delete it again, but not happy about it. any other suggestions?

    #736783

    Hi!

    Did you copy the code from your email? The quotes will be converted to their html entity form thus the error. Please copy it directly from this forum.

    Cheers!
    Ismael

    #957233

    Hello Ismael,

    I was looking for a sort of simular solution. I have posts created in the advanced layout builder and I also want show the category they belong to within the post.

    However I need to create one button (when not possible with the normal buttons, I can use css to make it look like a button) with the name of the parent category and one button with the name of the child category. Also, these ” buttons” need to link to a specific page.

    I understand that this is a bit different than the above mentioned solution, but perhaps you can help me in the right direction?

    Thanks in advance.

    Best regards,

    Jorrit

    #958449

    Hi,

    @Jorrit: You may want to look into the get_the_terms function. It’s the same as the “the_terms’ function but it’ll give you more control over the data or terms/categories. There’s a lot of example in the documentation.

    // https://developer.wordpress.org/reference/functions/get_the_terms/

    Best regards,
    Ismael

    #961251

    Hi Ismael,

    I now used:
    function custom_categories_shortcode() {
    global $post;
    ob_start();
    the_terms( $post->ID, ‘category’, ‘Dossier-Thema: ‘, ‘ , ‘ );

    $output = ob_get_clean();
    return $output;
    }
    add_shortcode(‘the_post_categories’, ‘custom_categories_shortcode’);

    I can’t get it to work with the information in your link. I want to show the parent category of the post and the child category. Also, I need to be able to give the displayed category a link.

    Can you help me in the right direction?

    Thanks in advance.

    Best regards,

    Jorrit

    #962931

    Hi,

    Thanks for the update. Please replace the filter with this one.

    function avs_custom_categories_shortcode() {
    	$terms = get_the_terms( get_the_ID(), 'category' );
     
    	$output = "<span>"._('Dossier-Thema: ', 'avia_framework')."</span>";
    	foreach ( $terms as $term ) {
    	
    		// The $term is an object, so we don't need to specify the $taxonomy.
    		$term_link = get_term_link( $term );
    		
    		// If there was an error, continue to the next term.
    		if ( is_wp_error( $term_link ) ) {
    			continue;
    		}
    	
    		// We successfully got a link. Print it out.
    		$output .= '<p class="cat"><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></p>';
    	}
    
    	return $output;
    }
    
    add_shortcode('the_post_categories', 'avs_custom_categories_shortcode');

    Best regards,
    Ismael

    #1024194

    Great Ismael, it works!
    Thanks for your assistance.
    Regards
    Santiago

    #1024440

    Hi Santiago,

    Great, glad you got it working :-)

    Best regards,
    Rikard

Viewing 19 posts - 1 through 19 (of 19 total)

You must be logged in to reply to this topic.