Forum Replies Created

Viewing 15 replies - 1 through 15 (of 88 total)
  • Thread Starter itissue

    (@itissue)

    Wonderful! Thanks Craig! It is working now. ^_^

    Thread Starter itissue

    (@itissue)

    Thank you Craig. We do have an earlier version of the plugin, and am able to get everything working again. I’ll check back again once this issue is resolved in the latest version before updating.

    itissue

    (@itissue)

    Ah I see. Yeah glad your site is working now.

    itissue

    (@itissue)

    It seems like you have this in your bullet:
    <span class="tc-dropcap">I</span>

    Remove the span tag so that it’s just “I” by itself and it should be fine.

    itissue

    (@itissue)

    Oh great glad it solved itself.

    itissue

    (@itissue)

    meokk, do you mean you would like to use the same WordPress install as https://www.meokk.com, but create a subdomain off of that install? If so you may take a look at WordPress Multisite.

    https://codex.www.ads-software.com/Create_A_Network

    You may take a look at this before deciding if that’s what you want:
    https://codex.www.ads-software.com/Before_You_Create_A_Network

    Hope that helps.

    Sue

    itissue

    (@itissue)

    jeremyd1980, did you define chosen anywhere? If you are using chosen from this line,
    <script type='text/javascript' src='https://www.soill.org/wp-content/plugins/gravityforms/js/chosen.jquery.min.js?ver=1.8.22'></script>,

    you probably need to declare it before this line:
    <script type='text/javascript' src='https://www.soill.org/wp-content/plugins/gravityforms/js/gravityforms.js?ver=1.8.22'></script>

    I believe. Let me know if that helps.

    Thread Starter itissue

    (@itissue)

    I found a way to make the page display the categories automatically instead of having to manually create the categories page content.

    Here’s the gallery-template.php file with all the code needed to make albums and sub albums.

    https://pastebin.com/XvHrdyma

    You’ll need to change
    $gallery_page = ‘/projects/’;
    $category_page = ‘/projects-by-category/’;
    $all_albums = ‘All Projects »’;
    $all_categories = ‘Projects by Category »’;

    $gallery_page is the page that you create to show the albums, using the gallery template.

    $category_page is the page that you create to show the categories or parent albums, using the gallery template as well.

    $all_albums is the text for the breadcrumb link for viewing all albums.
    $all_categories is the text for the breadcrumb link for viewing all parent albums.

    Thread Starter itissue

    (@itissue)

    I’ve done it! Now everything is dynamic. I’ll write an article on it after I’m done with the entire project and can show people. For now, here are some snippets. Suggestions for improvement are welcome.

    Note: This is all in gallery_template.php in your theme folder.

    Variables

    global $parent_id;
    global $cat_value;
    global $query_parent_id;
    global $query_parent_title;

    I made them global because they are used in and out of if and loops.

    $parent_id is what we’re trying to obtain. $cat_value is the query string value. $query_parent_id is the parent id from the SQL query. $query_parent_title is the parent title from the SQL query.

    Here’s the query I used:

    $parents = $wpdb->get_results("SELECT post_title, id FROM wp_posts WHERE (post_parent = 0 AND post_type = 'gallery' AND post_status = 'publish')");

    I want to get the post_title and id of the parent albums to use later.

    Here’s where I’m getting the post_title and id from each array item. Then I’m comparing the parent_title with the query string title. I’m making the parent_title lowercase so they match since the query string is all lowercase but the album title is capitalized. There may need adjustments if say your album has more than one word and your query string uses dashes. Then you can use str_replace on the album title. Unless there’s a better way.

    Then if the parent_title matches the query string value, then assign id to $parent_id.

    foreach($parents as $parent) {
    	$query_parent_id = $parent->id;
    	$query_parent_title = strtolower($parent->post_title);
    	if(isset($_GET['cat'])) {
    		$cat_value = $_GET['cat'];
    		// compare the queried parent_title with the query string value, then assign its id to $parent_id
    					if($query_parent_title==$cat_value) { $parent_id = $query_parent_id; }
    	}
    }

    Here’s where I added the post_parent filter, and $parent_id finally comes into good use. It’s saying find all gallery posts that are published and order them by post date, with no set posts per page, and have the same parent id as the one you found before through the query string and id matching.

    $args = array(
    	'post_type' => 'gallery',
    	'post_status' => 'publish',
    	'orderby' => 'post_date',
    	'posts_per_page' => -1,
    	'post_parent' => $parent_id
    );

    I forgot, you also need to have a page for the parent albums and link the albums to
    ?cat=album
    and where album is is the name of your album. This page you’ll have to make yourself instead of with the auto-generated. I’m assuming there’s a more automatic way to do this if you can write a program for it, but for now this is as far as I got.

    Feel free to share your ideas!

    Thread Starter itissue

    (@itissue)

    Well I got the SQL statement to use:

    SELECT post_title, id
    FROM  wp_posts
    WHERE (
    post_parent =0
    AND  post_type =  "gallery"
    AND  post_status =  "publish"
    )

    Yay!! Getting there. (Where wp is is the prefix you use for your tables)

    Thread Starter itissue

    (@itissue)

    Thanks kchayka for being there so I’m not the only one on this thread. I couldn’t figure out how to not hardcode the query string values without using SQL queries to get the table with the parent titles and ids to match with the children ones, which may also not be a good thing to do. Maybe that’s better than hardcoding. I’ll try working on this and then document it better so it might help someone in the future in case they are looking for the same functionality. I’ll keep you posted.

    Thanks bestwebsoft for responding. Maybe you can work something out for the future? I do hope it may be in the future. Thanks for developing this plugin for us all to use. It’s nice in that it’s pretty simple and easy to set up.

    Thread Starter itissue

    (@itissue)

    Oh!!!! I got it! I didn’t write my if statements correctly.

    global $parent_id;
    global $url;
    
    if(isset($_GET['cat'])) {
    	$url = $_GET['cat'];
    	if($url=="residential") { $parent_id = 30; }
    	elseif($url=="commercial") { $parent_id = 145; }
    	else $parent_id = "";
    }
    
    ........
    
    $args = array(
    						'post_type'					=> 'gallery',
    						'post_status'				=> 'publish',
    						'orderby'						=> 'post_date',
    						'posts_per_page'		=> -1,
    						'post_parent'	=> $parent_id
    					);
    Thread Starter itissue

    (@itissue)

    I thought of an idea, but haven’t gotten it to work, though it should work in theory. I created a query string called cat and when it’s “residential”, then the gallery template will filter “residential” based on the “residential id”. I tried making the filter in $args = array(); as

    'post_parent' => $parent_id

    and the $parent_id is something like this:

    global $parent_id;
    
    					if(isset($_GET['cat'])) { $url = $_GET['cat']; }
    					if($url="residential") { $parent_id = 145; }
    					if($url="commercial") { $parent_id = 30; }

    But it isn’t working.

    I also hope the plugin author may respond. It would be nice to know how to do this.

    Thread Starter itissue

    (@itissue)

    I may think about this more. There has to be a better way. Meanwhile, if someone else has a better idea, please feel free to chime in. Thanks!

    Thread Starter itissue

    (@itissue)

    Is there a better solution? That’s what I was trying to look for, but I couldn’t find it, so that’s why I am stuck with this solution.

Viewing 15 replies - 1 through 15 (of 88 total)