Import data from csv file into a page template

Hi Guys,
I have a lot of data in a csv, it is music records featuring title, artist, image and buy links. I have built a page template in pro that I like. Rather then build 5,000 pages by copying and pasting, is there an easy way to import this data into pro using that template and building a new page or post for each entry? I have experience in ecom product data sheets. I am looking for something like that but without the ecom aspect. No cart, etc…

This would be an amazing feature to have. I am trying to port info from another site and am having trouble with the custom post types they are built in. Maybe this is an easier way…

Hello There,

Thanks for writing in and a very detailed information. Regretfully there isn’t a feature available at the moment that you can easily import data from CSV into Pro page template. We’ve added this as a feature request so it can be taken into consideration for future development.

Thank you for your understanding.

Okay, I have tried another attempt and I think I am close. Can you please provide some assistance?

I followed the suggestion here:

and was able to create a custom post type called records. I have tried to add the shortcode from my desired page into the wp-single-records.php. But it does not display correct.

My goal is to create a post template based on my page and import the csv data into it with wp-all import.

Here is the code:

<?php // ============================================================================= // VIEWS/ETHOS/WP-SINGLE.PHP // ----------------------------------------------------------------------------- // Single post output for Ethos. // ============================================================================= $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true ); ?> <?php get_header(); ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( 'ethos', 'content-records', get_post_format() ); ?>
      <?php x_get_view( 'global', '_comments-template' ); ?>
      <?php echo do_shortcode('[cs_content][cs_element_section _id="1"][cs_element_row _id="2"][cs_element_column _id="3"][cs_element_image _id="4"][x_share title="Share This" share_title="" facebook="true" twitter="true" google_plus="false" linkedin="false" pinterest="true" reddit="false" email="true" email_subject="Hey, thought you might enjoy this! Check it out when you have a chance:"][/cs_element_column][cs_element_column _id="6"][cs_element_headline _id="7"][cs_element_text _id="8"][cs_icon_list][cs_icon_list_item title="Apple Music" type="apple" link_enabled="true" link_url="https://itunes.apple.com/us/album/boogie-chillun-live/162338729" link_new_tab="true"]Apple Music[/cs_icon_list_item][cs_icon_list_item title="Amazon" type="amazon" link_enabled="true" link_url="https://www.amazon.com/Boogie-Chillun-John-Lee-Hooker/dp/B000000XF2" link_new_tab="true"]Amazon[/cs_icon_list_item][cs_icon_list_item title="Spotify" type="spotify" link_enabled="true" link_url="https://open.spotify.com/user/pontusadolfi/playlist/1OWnp6k4KGmZlrYx15EJG2" link_new_tab="true"]Spotify[/cs_icon_list_item][/cs_icon_list][x_button size="global" block="false" circle="false" icon_only="false" href="javascript:history.back();" title="" target="" info="none" info_place="top" info_trigger="hover" info_content=""]GO BACK[/x_button][/cs_element_column][/cs_element_row][/cs_element_section][/cs_content]'); ?>
    <?php endwhile; ?>

  </div>

  <?php if ( $fullwidth != 'on' ) : ?>
    <?php get_sidebar(); ?>
  <?php endif; ?>

</div>
<?php get_footer(); ?>

Perhaps I am copying the shortcode from the wrong place?

Here is the page I want to use as template:
http://concordportal.staging.wpengine.com/albums/john-lee-hooker-boogie-chillun/

and here is what that looks like with the custom post with added shortcode and a different image:
http://concordportal.staging.wpengine.com/records/test-record/

Thanks

Hi there,

Thanks for writing in.

The problem is with the shortcode generated from v2 elements. Those shortcode has ID and only callable to where it’s created (page where you built it).

Try using standard shortcode (classic cornerstone elements).

Thanks!

Thanks, how do I find the standard shortcode based on what I want?

Hello There,

You can turn off the v2 elements and only use the classic ones by going to X > Cornerstone or Pro > Settings and select “Content Builder Elements”.

Hope this helps.

Can I just rebuild the page only using classic elements? I am using v2 all over the place in other pages.

Yeah, sure you can.

Okay I tried that but now I am getting an error. Here is the new code

<?php // ============================================================================= // VIEWS/ETHOS/WP-SINGLE.PHP // ----------------------------------------------------------------------------- // Single post output for Ethos. // ============================================================================= $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true ); ?> <?php get_header(); ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( 'ethos', 'content-records', get_post_format() ); ?>
      <?php x_get_view( 'global', '_comments-template' ); ?>
      <?php echo do_shortcode('[cs_content][cs_element_section _id="1"][cs_element_row _id="2"][cs_element_column _id="3"][x_image type="none" src="http://concordportal.staging.wpengine.com/wp-content/uploads/2017/12/boogie-chillun.jpg" alt="" link="false" href="#" title="" target="" info="none" info_place="top" info_trigger="hover" info_content=""][x_share title="Share This" share_title="" facebook="true" twitter="true" google_plus="false" linkedin="false" pinterest="true" reddit="false" email="true" email_subject="Hey, thought you might enjoy this! Check it out when you have a chance:"][/cs_element_column][cs_element_column _id="6"][x_custom_headline level="h2" looks_like="h3" accent="false"]JOHN LEE HOOKER - BOOGIE CHILLUN[/x_custom_headline][cs_text]<p>Recorded live in November 1962 in San Francisco, Boogie Chillun features Hooker performing solo in a laid-back, 'unplugged' mode. Employing a mixture of acoustic and electric sounds, Hooker treats the crowd to such classics as the titular 'Boogie Chillun' and 'Dimples' (retitled as 'I Like to See You Walk') in an intimate setting. Presented as a 2-LP set, this is the kind of John Lee Hooker record you want to hear 'round about midnight when the lights are low and one that every serious fan should have in their vinyl collection.</p>[/cs_text][cs_icon_list][cs_icon_list_item title="Apple Music" type="apple" link_enabled="true" link_url="https://itunes.apple.com/us/album/boogie-chillun-live/162338729" link_new_tab="true"]Apple Music[/cs_icon_list_item][cs_icon_list_item title="Amazon" type="amazon" link_enabled="true" link_url="https://www.amazon.com/Boogie-Chillun-John-Lee-Hooker/dp/B000000XF2" link_new_tab="true"]Amazon[/cs_icon_list_item][cs_icon_list_item title="Spotify" type="spotify" link_enabled="true" link_url="https://open.spotify.com/user/pontusadolfi/playlist/1OWnp6k4KGmZlrYx15EJG2" link_new_tab="true"]Spotify[/cs_icon_list_item][/cs_icon_list][x_button size="global" block="false" circle="false" icon_only="false" href="javascript:history.back();" title="" target="" info="none" info_place="top" info_trigger="hover" info_content=""]GO BACK[/x_button][/cs_element_column][/cs_element_row][/cs_element_section][/cs_content]'); ?>
    <?php endwhile; ?>

  </div>

  <?php if ( $fullwidth != 'on' ) : ?>
    <?php get_sidebar(); ?>
  <?php endif; ?>

</div>
<?php get_footer(); ?>

here is page:
http://concordportal.staging.wpengine.com/records/test-record/

I fixed the error, but still no luck on getting this to display.

Hello There,

You will need the classic section, classic row and classic columns too! Whenever you want to add a section to the cornerstone you can hold the cmd key on Mac or ctrl key on windows and it will change to add a classic section.

Hope this helps. Please let us know how it goes.

Awesome! That worked, but now how do I replace those placeholders with custom fields or how do I update that data from a csv? Any ideas?
Thanks

Hey There,

Thanks for updating in! If you are working with custom fields, you can make use of the ACF Pro plugin. To know more about this plugin and how you can apply it to a Cornerstone or a page, please check this out:

As we have mentioned it before, there isn’t a feature available at the moment that you can easily import data from CSV into Cornerstone/Pro page template. We’ve added this already as a feature request so it can be taken into consideration for future development.

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.