[Resolved] Different text in blue box for each page

Home Forums Support [Resolved] Different text in blue box for each page

Home Forums Support Different text in blue box for each page

Viewing 15 posts - 1 through 15 (of 47 total)
  • Author
    Posts
  • #2329402
    Karen

    Hi there, we’d like to make it so that the text changes automatically on each page in this blue box.blue boxKind of like a testimonial slider but no slide. Just a different “Promise”/text on each page.

    We’ve done this many times using a custom Genesis child theme but it’s difficult to use custom with GP pages.

    Can you tell me how we can do this in GP?

    Thanks in advance!

    #2329488
    David
    Staff
    Customer Support

    Hi there,

    where would this text be stored ?

    #2329657
    Karen

    The whole thing is up in the air since we’re used to using different tools. You tell me please if it can be done and where you recommend storing it.

    #2329667
    David
    Staff
    Customer Support

    If you have many different texts to display, then i would suggest registering a Custom Post Type in your child theme to store them.
    It doesn’t have to be anything complicated. You could save the “quote” as the content, and the “citation” as the post title.
    You can create a CPT for your child theme using this online generator:

    https://generatewp.com/post-type/

    You can then use GenerateBlocks Query Loop or a bit of code to show the posts where you need them

    #2329680
    Karen

    Okay, let me take a look and let you know if I have questions. But that’s right, the “quote” and “citation” styling stays the same – just the actual copy/text changes.

    Do you have an article to put this altogether or should I just follow the post type link you gave above?

    #2329698
    David
    Staff
    Customer Support

    The Generator can look a little daunting, but its just a series of fields to complete.

    I would begin with deciding what the Post type will be called eg Quotes
    And then that can be referenced in the settings.

    For the General Tab:
    1. Function – for example: custom_quotes_post_type
    2. Enable Child Theme Support
    3. Give it a text_domain – maybe the name of the websites. For example we use: generatepress

    For the Post Type and Labels, these are whatever you want but you may want to reference your post type eg. Quote single and Quotes plural.

    Options
    I think Title and Content is enough.
    I am not sure you want an Archive. So maybe unset that and leave the rest as default.

    Visibility and Query and Permalinks
    Most likely leave as default

    Capabilities
    Just decide if you want Page ( Hierarchy ) or Posts ( taxonomies, authors and dates ). Leave the rest as is.

    Rest API
    Show in Rest – change to Yes.
    leave rest as defqult

    Once done update the Code, and copy the code to your child theme. You should now have a new CPT available in your admin
    Once you have some posts added to it. Try using the GB Query Loop to display them. If that works we can talk about how and where you want to display them

    #2329843
    Karen

    I added the code and “Quotes” was added to the dashboard. However, when I try adding a post and publishing / updating it, it won’t work. The post is no where to be found (not in Posts either). And also, I must have done something incorrect on the generator b/c now all the blog posts that were in Posts are gone. I can still access them from the blog but they’re not in Posts. Weird.

    One thing that I wasn’t sure about in the generator was where to add “quotes/quote” in the labels tab so not sure I did that correctly.

    I’m giving you login access. You can see the code on the functions.php file.

    #2329858
    Karen

    Update to above comment: I actually removed the code from the functions.php file b/c it was canceling out the regular blog posts. I just removed the code and they’re back.

    Here’s the code:

    if ( ! function_exists('custom_quotes_post_type') ) {
    
    // Register Custom Post Type
    function custom_quotes_post_type() {
    
    	$labels = array(
    		'name'                  => _x( 'Quotes', 'Post Type General Name', 'danyc' ),
    		'singular_name'         => _x( 'Quote', 'Post Type Singular Name', 'danyc' ),
    		'menu_name'             => __( 'Quote', 'danyc' ),
    		'name_admin_bar'        => __( 'Quote(s)', 'danyc' ),
    		'archives'              => __( 'Item Archives', 'danyc' ),
    		'attributes'            => __( 'Item Attributes', 'danyc' ),
    		'parent_item_colon'     => __( 'Parent Item:', 'danyc' ),
    		'all_items'             => __( 'All Items', 'danyc' ),
    		'add_new_item'          => __( 'Add New Item', 'danyc' ),
    		'add_new'               => __( 'Add New', 'danyc' ),
    		'new_item'              => __( 'New Item', 'danyc' ),
    		'edit_item'             => __( 'Edit Item', 'danyc' ),
    		'update_item'           => __( 'Update Item', 'danyc' ),
    		'view_item'             => __( 'View Item', 'danyc' ),
    		'view_items'            => __( 'View Items', 'danyc' ),
    		'search_items'          => __( 'Search Item', 'danyc' ),
    		'not_found'             => __( 'Not found', 'danyc' ),
    		'not_found_in_trash'    => __( 'Not found in Trash', 'danyc' ),
    		'featured_image'        => __( 'Featured Image', 'danyc' ),
    		'set_featured_image'    => __( 'Set featured image', 'danyc' ),
    		'remove_featured_image' => __( 'Remove featured image', 'danyc' ),
    		'use_featured_image'    => __( 'Use as featured image', 'danyc' ),
    		'insert_into_item'      => __( 'Insert into item', 'danyc' ),
    		'uploaded_to_this_item' => __( 'Uploaded to this item', 'danyc' ),
    		'items_list'            => __( 'Items list', 'danyc' ),
    		'items_list_navigation' => __( 'Items list navigation', 'danyc' ),
    		'filter_items_list'     => __( 'Filter items list', 'danyc' ),
    	);
    	$args = array(
    		'label'                 => __( 'Quote', 'danyc' ),
    		'description'           => __( 'Post Type Description', 'danyc' ),
    		'labels'                => $labels,
    		'supports'              => array( 'title', 'editor' ),
    		'taxonomies'            => array( 'category', 'post_tag' ),
    		'hierarchical'          => false,
    		'public'                => true,
    		'show_ui'               => true,
    		'show_in_menu'          => true,
    		'menu_position'         => 5,
    		'show_in_admin_bar'     => true,
    		'show_in_nav_menus'     => true,
    		'can_export'            => true,
    		'has_archive'           => true,
    		'exclude_from_search'   => false,
    		'publicly_queryable'    => true,
    		'capability_type'       => 'page',
    		'show_in_rest'          => true,
    	);
    	register_post_type( 'post_type', $args );
    
    }
    add_action( 'init', 'custom_quotes_post_type', 0 );
    
    }
    #2330204
    David
    Staff
    Customer Support

    Odd, it errors for me too.
    But i made this one:

    if ( ! function_exists('custom_quote_post_type') ) {
    
    // Register Custom Post Type
    function custom_quote_post_type() {
    
    	$labels = array(
    		'name'                  => _x( 'Quotes', 'Post Type General Name', 'dannyc' ),
    		'singular_name'         => _x( 'Quote', 'Post Type Singular Name', 'dannyc' ),
    		'menu_name'             => __( 'Quotes', 'dannyc' ),
    		'name_admin_bar'        => __( 'Quotes', 'dannyc' ),
    		'archives'              => __( 'Quote Archives', 'dannyc' ),
    		'attributes'            => __( 'Quote Attributes', 'dannyc' ),
    		'parent_item_colon'     => __( 'Parent Quote:', 'dannyc' ),
    		'all_items'             => __( 'All Quotes', 'dannyc' ),
    		'add_new_item'          => __( 'Add New Quote', 'dannyc' ),
    		'add_new'               => __( 'Add New', 'dannyc' ),
    		'new_item'              => __( 'New Quote', 'dannyc' ),
    		'edit_item'             => __( 'Edit Quote', 'dannyc' ),
    		'update_item'           => __( 'Update Quote', 'dannyc' ),
    		'view_item'             => __( 'View Quote', 'dannyc' ),
    		'view_items'            => __( 'View Quotes', 'dannyc' ),
    		'search_items'          => __( 'Search Quote', 'dannyc' ),
    		'not_found'             => __( 'Not found', 'dannyc' ),
    		'not_found_in_trash'    => __( 'Not found in Trash', 'dannyc' ),
    		'featured_image'        => __( 'Featured Image', 'dannyc' ),
    		'set_featured_image'    => __( 'Set featured image', 'dannyc' ),
    		'remove_featured_image' => __( 'Remove featured image', 'dannyc' ),
    		'use_featured_image'    => __( 'Use as featured image', 'dannyc' ),
    		'insert_into_item'      => __( 'Insert into item', 'dannyc' ),
    		'uploaded_to_this_item' => __( 'Uploaded to this item', 'dannyc' ),
    		'items_list'            => __( 'Items list', 'dannyc' ),
    		'items_list_navigation' => __( 'Items list navigation', 'dannyc' ),
    		'filter_items_list'     => __( 'Filter items list', 'dannyc' ),
    	);
    	$args = array(
    		'label'                 => __( 'Quote', 'dannyc' ),
    		'description'           => __( 'A place for saving quotes', 'dannyc' ),
    		'labels'                => $labels,
    		'supports'              => array( 'title', 'editor' ),
    		'taxonomies'            => array( 'category', 'post_tag' ),
    		'hierarchical'          => false,
    		'public'                => true,
    		'show_ui'               => true,
    		'show_in_menu'          => true,
    		'menu_position'         => 5,
    		'show_in_admin_bar'     => true,
    		'show_in_nav_menus'     => true,
    		'can_export'            => true,
    		'has_archive'           => false,
    		'exclude_from_search'   => false,
    		'publicly_queryable'    => true,
    		'capability_type'       => 'post',
    		'show_in_rest'          => true,
    	);
    	register_post_type( 'quote-cpt', $args );
    
    }
    add_action( 'init', 'custom_quote_post_type', 0 );
    
    }
    #2330706
    Karen

    Thanks! That works and I went through the post type tool to see what you did and where missed a field or two.

    I added the Posts. Can you send me a link (or describe here) about how to use/set up the GB Query Loop and how to display the posts?

    #2330974
    Fernando
    Customer Support

    Hi Karen,

    Here are a couple of articles with regards to the GB Query Loop Block:

    https://docs.generateblocks.com/article/query-loop-overview/

    https://generateblocks.com/creating-related-posts-with-query-loop-block/

    If you’ll need further assistance, feel free to reach out and we’ll do our best to assist.

    #2335346
    Karen

    Thank you.

    David, we created a blue box for the promises as an element. Can you please explain from the beginning how to do the query loop? Are you starting from an element or…? If you can send step-by-step directions on how to do this, I’d be so appreciative. I’ve got CPTs and I entered all 12 promises as an individual CPT post.

    #2335401
    Fernando
    Customer Support

    Hi Karen,

    May we know how and exactly where you want the GB Query loop displayed in your site?

    #2335408
    Karen

    Thanks so much Fernando. Is there anyway David could jump in? He and I have been going back-and-forth for the whole string. I explained in several posts back exactly what we wanted to do.

    #2335426
    Fernando
    Customer Support

    David’s out of shift right now. I’ll let him know.

Viewing 15 posts - 1 through 15 (of 47 total)
  • You must be logged in to reply to this topic.