Property Management Site [Solved]

Hi folks. I’m working on a vacation property site, and I had to remove woocommerce and woo bookings from a current project and redo it using a different method without having the woo code in the system. But essentially, I’m trying to duplicate how woo stored products in the system, with attributes that can be attached to them, faceted, and displayed on the front end.

I’m currently using CPT UI and ACF Pro to do this (though I am just learning both of these tools) and I’m under the impression I simply:

Add the “properties” CPT to the system. Which I did and seems to have taken.

Now I want to add the attributes to these properties but I’m not exactly sure how I should set them up and store them in the DB, and some examples are:

Property Type (Ocean View, Ocean front, Wooded)
Bedrooms (1, 2 3, … 10)
Sleeps (1, 2 3, … 10)
Pets (Yes, No, Ask)
Location
Price (Will leave that to booking plugin)
Amentities (Cable TV, Front Porch, Firepit)

Now should I just add the CPT, and then start making fields for it using the above information? Or should I make these as Taxonomies or Categories and then do it another way?

Any help would be appreciated.

The end goal would be to sort properties using “The Grid” pulling from the CPT.

Also, am I required to make any custom templating to get this to work as well?

This is what I have so far and I really could use some help on what direction I should build this in so I don’t have to redo it at a later date (again)

https://vc.goiww.com/properties/

Thanks.

Hi there,

Thanks for posting in.

Since this looks like a group of data that users need to choose, I think adding fields is easier than taxonomy. Just use ACF Pro and add proper fields.

The hard part will be displaying those options as a form in the front since that look likes options. You will have to customize it to integrate the post type template, ACF Pro, and selectable fields (form fields).

Thanks!

I’m trying to figure out which file I need to create it’s own single post template and archive post template.
I’ve been looking through old support posts and the only thing I can see is dealings with cornerstone and I’m using Pro. In the cornerstone threads they said to access the framworks/views folders and copy archive-post.php to the childtheme/archive-cptname.php

Well in Pro all i see is content-gallery -image -link -portfolio etc.php

But there is one called content.php … and also one called wp-single.php

Which files do I want to copy and where if I want to use the CPT “properties” in my setup?

Thanks!

Hi There,

Yes, basically, for archive page, we can copy default template which is index.php from the root folder of the theme. Let’s say you have this file already: child-theme/archive-cptname.php
What we have to put there is the content of pro/index.php
The index.php file has this line of code:
<?php x_get_view( x_get_stack(), 'wp', 'index' ); ?>
That line of code instruct the template file to get the content of another file \pro\framework\views\integrity\wp-index.php.
So on your child-theme/archive-cptname.php let’s get the content of this file \pro\framework\views\integrity\wp-index.php directly by adding the following:

<?php get_header(); ?>

  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php x_get_view( 'global', '_index' ); ?>

    </div>

    <?php get_sidebar(); ?>

  </div>

<?php get_footer(); ?>

For single-properties.php, do the same process, but use pro/single.php template.

Hope this helps.

1 Like

Yes, I’ve managed to make it that far but luck and testing. I am currently having this issue now. How do I control these elements or change them as I don’t need author or date.

I also need to display some get_fields() on the archive page, like beds, sleeps, bathrooms, etc. while the full property info would be on single-properties.php

thanks for the help

Budd

Hello Budd,

Thanks for updating in!

1.) To remove the author or date, simply go to X > Theme Options > Blog > Content and turn off the the Post Meta option.

2.) To add the get_field() function in your properties, you will have to manually add the lines in the index.php and the single-properties.php file

Hope this helps.

I went in there, but those settings are already turned off.

Also it makes a div with a box shadow. I’d like to be able to get into that part of the code and alter within the div if possible.

Any ideas?

Hi again,

You can hide the post meta via custom CSS as well, first find the ID of the page to hide the post meta on that specific page only by following this link https://theme.co/apex/forum/t/setup-how-to-locate-post-ids/59

Then add the following CSS code in the Theme Options > CSS:

.page-id-3034 .p-meta {
    display: none;
}

Make sure to replace page-id-3034 with actual ID.

I visited https://vc.goiww.com/properties/ and couldn’t find anything you mentioned regarding a div with a box shadow., can you please share the page URL of we can take a closer look?

Thanks!

I had to wipe out the CPT and custom fields and start over as this is a bit much. All I want to do is use “The Grid” as the displayer of content for a custom post type.

And I want to be able to to customize the grid to be able to display certain fields when you access the cpt /properties/

if the grid doesn’t work like that then i want to be able to add the fields within the div so I can try to make my own layout.

here’s the div i’m talking about:

Hi there,

, First of all, we are sorry that in the previous answers we did not mention that the request is a customization and is way outside of our support scope. We will do our best to help you out achieve the feature you want but we will not guarantee nor give a customization service.

You can not have out of the box custom fields and post type access in The Grid or Essential Grid. You may need to use the Custom Fields in Essential Grid plugin which may be a good starting point regarding the case:

https://www.themepunch.com/faq/use-image-from-custom-field-as-grid-items-main-media/

I also suggest that you check this Google Search for more information.

Kindly open up new threads for additional questions as it will help us to focus on each issue and give you a better support which you deserve. Having a long threads makes the maintaining job harder and also it will be harder for the other customers to find the correct information if they have similar issues. You are always welcomed to reply to this thread to follow up the same question.

Thank you.

Ok that’s fine. Do you know the answer to the question regarding what file I edit to edit the look within the div in the previous screenshot?

Thanks
B

Hi there,

The code is located on this template

\framework\views\integrity\_content-post-header.php

You can copy that file to your child theme with exact folder structure/path. Then edit it,

As for the post meta, just add this code to your child theme’s functions.php with your preferred changes

  function x_integrity_entry_meta() {

    //
    // Author.
    //

    $author = sprintf( '<span><i class="x-icon-pencil" data-x-icon="&#xf040;"></i> %s</span>',
      get_the_author()
    );


    //
    // Date.
    //

    $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon="&#xf073;"></i> %2$s</time></span>',
      esc_attr( get_the_date( 'c' ) ),
      esc_html( get_the_date() )
    );


    //
    // Categories.
    //

    if ( get_post_type() == 'x-portfolio' ) {
      if ( has_term( '', 'portfolio-category', NULL ) ) {
        $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
        $separator         = ', ';
        $categories_output = '';
        foreach ( $categories as $category ) {
          $categories_output .= '<a href="'
                              . get_term_link( $category->slug, 'portfolio-category' )
                              . '" title="'
                              . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                              . '"><i class="x-icon-bookmark" data-x-icon="&#xf02e;"></i> '
                              . $category->name
                              . '</a>'
                              . $separator;
        }

        $categories_list = sprintf( '<span>%s</span>',
          trim( $categories_output, $separator )
        );
      } else {
        $categories_list = '';
      }
    } else {
      $categories        = get_the_category();
      $separator         = ', ';
      $categories_output = '';
      foreach ( $categories as $category ) {
        $categories_output .= '<a href="'
                            . get_category_link( $category->term_id )
                            . '" title="'
                            . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                            . '"><i class="x-icon-bookmark" data-x-icon="&#xf02e;"></i> '
                            . $category->name
                            . '</a>'
                            . $separator;
      }

      $categories_list = sprintf( '<span>%s</span>',
        trim( $categories_output, $separator )
      );
    }


    //
    // Comments link.
    //

    if ( comments_open() ) {

      $title  = apply_filters( 'x_entry_meta_comments_title', get_the_title() );
      $link   = apply_filters( 'x_entry_meta_comments_link', get_comments_link() );
      $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() );

	    $text = ( 0 == $number ) ? __( 'Leave a Comment', '__x__' ) : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );

$comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon="&#xf086;"></i> %3$s</a></span>',
        esc_url( $link ),
        esc_attr( sprintf( __( 'Leave a comment on: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
        $text
      );

    } else {

      $comments = '';

    }


    //
    // Output.
    //

    if ( x_does_not_need_entry_meta() ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
        $author,
        $date,
        $categories_list,
        $comments
      );
    }

  }

Thanks!

Say I wanted to use this code and edit this file in my child theme. Where would I put it and what would I name it if I wanted to only use it on the properties CPT?

Thanks.

Hello There,

You can add this code in your child theme’s functions.php file. Off course you will need some modifications if you only want the code to apply in the properties CPT. You will need something like this:

function function_name(){
  if ( 'property' == get_post_type()  ) {
    // the necessary code here
  }
}

Hope this make sense.

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