Forum Replies Created

Viewing 13 replies - 16 through 28 (of 28 total)
  • it would be cool to do custom email templates through the WP admin panel and allow BCC to the website administrator or some other method of tracking form activity so the website owner can keep track of leads generated through the directory ??

    Thread Starter Russ Powers

    (@russwebguy)

    So I notice a bit of a glitch with my last post. It seems that the categories will display backwards randomly. So I’ve wrote a fresh script that will prevent the categories from being displayed backwards. I’m going to resolve this topic and start a new one for breadcrumbs

    Thread Starter Russ Powers

    (@russwebguy)

    I’ve figured out a way to include breadcrumbs!!! I’ve provided the scripts I wrote below along with instructions!!! Enjoy! ??

    I added the following code to the category.php tempate file

    <a href="../../directory">Directory</a> // Replace with the page slug and name you use for the directory home page.
    <?php
    $product_terms = wp_get_object_terms($post->ID, 'listing_category');
    $subs = ldl_get_categories(get_queried_object()->term_id );
    if(($subs) || is_tax( 'listing_tag' )) { // tags doesn't have sub categories so we exclude them
    	echo '&raquo; '.get_queried_object()->name;
    } else {
    	if(!empty($product_terms)){
    	  if(!is_wp_error( $product_terms )){
    		foreach($product_terms as $term){
    		  echo '&raquo; <a href="'.get_term_link($term->slug, 'listing_category').'">'.$term->name.'</a>';
    		}
    	  }
    	}
    }
    ?>

    I added the following code to the single.php template file

    <a href="../../directory">Directory</a> &raquo; // Replace with page slug and name you use for the directory home page.
    <?php
    $product_terms = wp_get_object_terms($post->ID, 'listing_category');
    if(!empty($product_terms)){
      if(!is_wp_error( $product_terms )){
        foreach($product_terms as $term){
          echo '<a href="'.get_term_link($term->slug, 'listing_category').'">'.$term->name.'</a> &raquo; ';
        }
      }
    }
    ?><?php the_title(); ?>

    SIDE NOTE::

    If you are using sub categories and the bread crumb comes back as “Directory >> Sub-Category >> Parent Category >> Listing Title” you can make the following modification to the foreach loops:

    foreach(array_reverse($product_terms) as $term){

    Hope this helps!!

    Thread Starter Russ Powers

    (@russwebguy)

    ^ oh related to my last post above ^

    Is there a way to query the parent category name and slug when viewing a sub category?

    Thread Starter Russ Powers

    (@russwebguy)

    I’ve tried the breadcrumbs tool from Yoast’s WordPress SEO plugin, but it really didn’t work. What I would like to accomplish is having a breadcrumb like so..

    Directory Home Page >> Category Name >> Listing

    I have been able to get a primitive breadcrumb to work on the category pages, but I can’t figure out how to hook in the category name and url on the single listing template. Once I get that down, we should have fully functional breadcrumbs! If I figure it out, I’ll send you copies to possibly implement in a future update ??

    I’ve also ran into another minor thing with tag permalinks, I couldn’t find any resources for this. I’m using the tags to group listings by city, but I can’t figure out the alternative permalink the following..

    https://www.mysite.com/?listing_tag=los-angeles

    I’m pretty sure there’s a way but can’t seem to figure it out lol

    Thread Starter Russ Powers

    (@russwebguy)

    get_queried_object() worked great on the category pages, but not single listings for some reason. I’m thinking a new function may have to be created to properly display the category names and slugs on the single.php template file.

    I’ll do some experimenting to see if I can write a complete breadcrumbs function for parent categories, child categories, and single posts. If I come up with something concrete, I’ll definitely share it if you want to include it in a future update or something ?? Same with the permalink structures.

    The overall design and functionality of this plugin is amazing and exactly what I’m looking for so I’m definitely going to stick with it.

    Also are these codes added to .php files for either the extension or contact form 7 itself? Or are we adding it to the “additional settings” text box at the bottom of the edit form page?

    Hey Eric,

    Tried your example but not sure if I’m getting it right. Can you provide a better example if possible? Like what exact code goes in the form that accepts the attachments, and the exact code that goes in the form that sends the email? This would be very helpful ??

    Thanks!

    Thread Starter Russ Powers

    (@russwebguy)

    So I’m marking this one as resolved. I may write a blog post/tutorial about this in the near future. If anyone’s interested it will be at [Link removed]

    Thread Starter Russ Powers

    (@russwebguy)

    Figured it out! Below is the working code ?? Add it anywhere in your product-page template (mine is in the title!)

    <?php
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    global $post, $woocommerce, $product;
    
    if ($product->is_downloadable('yes')) {
    	echo "<img src='downloadable.png'>";
    }else{
    	echo " ";
    }
    ?>

    Same can be done with virtual products by replacing is_downloadable with is_virtual in the snippet above.

    Thread Starter Russ Powers

    (@russwebguy)

    No worries, I completely understand the diversion ?? I made sure to replace my URL’s with www.remarpro.com in the code snippet above lol I was able to get the code above to work for a split second, generated the metabox and everything – but I had some code showing up at the top of all the pages in the admin panel.

    I’ve checked out a few of the pre-existing meta-box plugins but some of them are a little to complicated for me to find the very basic functions and syntax required. I’ve been looking for a plugin that adds a single meta-box for something silly like current mood or current song but haven’t found anything useful lol

    Thread Starter Russ Powers

    (@russwebguy)

    this is what I have so far lol

    <?php
    /*
    Plugin Name: custom meta box
    Plugin URI: https://www.remarpro.com
    Description: This plugin adds a custom meta box to the post page on the admin panel that allows user to enter post related data.
    Version: Beta
    Author: Russ Powers
    Author URI: https://www.remarpro.com
    */
    ?>
    
    <?php
        add_action( 'add_meta_boxes', 'cd_meta_box_add' );
        function cd_meta_box_add() {
            add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'cd_meta_box_cb', 'post', 'normal', 'high' );
        }
    ?>
    <?php
        function cd_meta_box_cb( $post ) {
    		$values = get_post_custom( $post->ID );
    		$text = isset( $values['my_meta_box_text'] ) ? esc_attr( $values['my_meta_box_text'][0] ) : ”;
    		$selected = isset( $values['my_meta_box_select'] ) ? esc_attr( $values['my_meta_box_select'][0] ) : ”;
    		$check = isset( $values['my_meta_box_check'] ) ? esc_attr( $values['my_meta_box_check'][0] ) : ”;
    		<p>
    			<label for="my_meta_box_text">Text Label</label>
    			<input type="text" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo $text; ?>" />
    		</p>
        }
     ?>
    Thread Starter Russ Powers

    (@russwebguy)

    I’ve checked out the writing a plugin page, but what I’m hoping to find is a simple plugin example that has somewhat similar functionality that I can toy around with. I’ve already created this functionality when I learned how to use custom fields, but I would like a more user friendly way to enter the data and not have it limited to the theme. I’m thinking that once I learn how to create meta-boxes with a plugin, that would open the door for me to be able to create a whole slew of useful plugins.

    Which leads me to my next question lol is it possible to use meta-boxes to fill in data for custom fields? I’m almost positive this is plausible but just want to make sure lol

Viewing 13 replies - 16 through 28 (of 28 total)