eastbank
Forum Replies Created
-
Thank you guys so much! I used the purely php as I have the booking form wrapped in a container that I also wanted removed if there was no bookings. There was one small tweak needed, the number 1 needed to be in quotes.
if( $EM_Event->event_rsvp === "1") { echo $EM_Event->output("#_BOOKINGFORM"); }
Forum: Plugins
In reply to: [Yoast SEO] Yoast SEO not availableI have the same problem, Yoast SEO Ver 7.2 on WordPress 4.9.5. Focus keywords will not save.
Forum: Plugins
In reply to: [WP Booking Calendar] Display booking schedule on frontend pageThank you, after using the little fix to get the info to show up in popups I was able to make my own solution with javascript.
Incase anyone else is interested, I’ll post my code. It should be noted that I’ve only given a single option for time slots on my booking calendar so only one appointment can be listed per day. This solution would probably need some tweaking if there were multiple listings in a single calendar day.
To make sure that all possibly scheduled dates get pulled into my generated list, I had to set the booking calendar shortcode to display 12 months at a time.
$(window).load(function(){ // add a list element to the page $('article').prepend('<ul id="scheduleList"></ul>'); // run the hover function here to get the user name/time data loaded into the page $('td.date_approved').mouseover(); // get data from each approved calendar day $('td.date_approved').each( function(){ var dateClasses = $(this).attr("class").split(' '); var trimScript = $(this).attr('onmouseover'); var bookingID = trimScript.slice(54,-1); var dateTrimmed = dateClasses[3].substring(9); var userInfo = $(this).attr('data-content').slice(156,-13); // build list item from collected data var list = '<li><span class="booked-date">' + dateTrimmed + '</span> - ' + userInfo + '</li>' // add list item to our list $('#scheduleList').append(list); }) });
That then displays a list that looks like this:
7-8-2016 – User Name
7-26-2016 – User Name
12-8-2016 – User NameI then hid the actual booking calendar on the page with CSS so only my generated list is displayed.
Forum: Plugins
In reply to: [Related Posts by Taxonomy] Not working on custom post typesI just got it squared away tonight using the plugin and then using the documented method for modifying one of the templates by placing it in my child theme. Had a real ‘doh!’ moment when i realized I was making it harder on myself than I needed to.
Thanks again for getting back. Great work on the plugin.
Forum: Plugins
In reply to: [Related Posts by Taxonomy] Not working on custom post typesThanks again for such a quick reply!
I will try your suggestion and will report back.
I would love to just use the plugin as you’ve suggested….would the way I build out the template to display the results be the same as in the example from the previous post?
Forum: Plugins
In reply to: [Related Posts by Taxonomy] Not working on custom post typesThanks for the reply, this worked perfectly for the shortcode. Thanks you!
I’m wondering why I can’t get your other code to work using the same fix?
I’d love to avoid using the plugin so I can more easily customize the markup of the related posts.
To jog the memory, here’s the code I’ve placed in my functions:
function get_related_tag_posts_ids( $post_id, $number = 5 ) { $related_ids = false; $post_ids = array(); // get tag ids belonging to $post_id $tag_ids = wp_get_post_tags( $post_id, array( 'fields' => 'ids' ) ); if ( $tag_ids ) { // get all posts that have the same tags $tag_posts = get_posts( array( 'posts_per_page' => -1, // return all posts 'no_found_rows' => true, // no need for pagination 'fields' => 'ids', // only return ids 'post__not_in' => array( $post_id ), // exclude $post_id from results 'tax_query' => array( array( 'taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $tag_ids, 'operator' => 'IN' ) ) ) ); // loop through posts with the same tags if ( $tag_posts ) { $score = array(); $i = 0; foreach ( $tag_posts as $tag_post ) { // get tags for related post $terms = wp_get_post_tags( $tag_post, array( 'fields' => 'ids' ) ); $total_score = 0; foreach ( $terms as $term ) { if ( in_array( $term, $tag_ids ) ) { ++$total_score; } } if ( $total_score > 0 ) { $score[$i]['ID'] = $tag_post; // add number $i for sorting $score[$i]['score'] = array( $total_score, $i ); } ++$i; } // sort the related posts from high score to low score uasort( $score, 'sort_tag_score' ); // get sorted related post ids $related_ids = wp_list_pluck( $score, 'ID' ); // limit ids $related_ids = array_slice( $related_ids, 0, (int) $number ); } } return $related_ids; } function sort_tag_score( $item1, $item2 ) { if ( $item1['score'][0] != $item2['score'][0] ) { return $item1['score'][0] < $item2['score'][0] ? 1 : -1; } else { return $item1['score'][1] < $item2['score'][1] ? -1 : 1; // ASC } }
I’ve tried adding ‘post_type’ => ‘video’ to the $tag_posts = get_posts array, but if I use anything aside from ‘post’ it doesn’t return any results.
I also tried it the way you have in the shortcode, with ‘post_types’ => ‘video’ but still no dice.
Thanks again for any help
Forum: Plugins
In reply to: [Plugin: Woocommerce] unable to customize archive-product.phpNo problem, one thing I’d recommend trying is changing to the twentytwelve theme and seeing if it works then. I tried that and that narrowed it down to something in my theme causing it.
It’s a place to start. Odds are it’s something in the theme, and not a problem with woocommerceForum: Plugins
In reply to: [Plugin: Woocommerce] unable to customize archive-product.phpHey clforever, are you using a child theme?
I found my issue was with my child theme, I was using Roots as my main theme and it worked fine if I turned off the child theme and I had to trouble shoot from there. Luckly everything I wanted to do was able to be achieved using a filter.Good luck!
Forum: Plugins
In reply to: [Plugin: Woocommerce] unable to customize archive-product.phpI’m having the exact same issue. Have edited other template files without issue, but can remove the archive-product.php completely from the plugins templates folder and from my custom theme folder and the page still displays just fine.
Hoping someone can shed some light on this.For anyone who sees this, I believe I found the problem.
I had imported posts from another wordpress site that had magic fields custom fields, I’ve since completely cleared all MF database tables and started from scratch and it appears to be stable now.Lesson learned: Do not import posts from another wordpress site that have MF custom field data.
Yep, I like this plugin a lot as well…but the lack of TinyMCE on the text area field is a real problem if you’re building a site for a client that doesn’t know HTML.
Forum: Plugins
In reply to: [Plugin: Magic Fields] Image Upload conflict with WP 3.5 upgradeNo problem, glad it worked!
Forum: Plugins
In reply to: [Plugin: Magic Fields] Image Upload conflict with WP 3.5 upgradeHere’s my main.php code, try this:
<?php /* Plugin Name: Magic Fields Plugin URI: https://magicfields.org Description: Create custom fields for your post types Version: 2.0.1 Author: Hunk and Gnuget Author URI: https://magicfields.org License: GPL2 */ /* Copyright 2011 Magic Fields Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * i18n */ global $mf_domain,$mf_pt_register; $mf_domain = 'magic_fields'; $mf_pt_register = array(); /** * Constants */ require_once( 'mf_extra.php' ); require_once( 'mf_constants.php' ); //auto loading files function mf_autoload( $name ) { //main files if( file_exists( MF_PATH.'/'.$name.'.php' ) ) { require_once( MF_PATH.'/'.$name.'.php' ); } //admin files if( file_exists( MF_PATH.'/admin/'.$name.'.php' ) ) { require_once( MF_PATH.'/admin/'.$name.'.php' ); } //field types if( file_exists( MF_PATH.'/field_types/'.$name.'/'.$name.'.php' ) ) { require_once( MF_PATH.'/field_types/'.$name.'/'.$name.'.php'); } } if (function_exists("__autoload")) { spl_autoload_register("__autoload"); } spl_autoload_register("mf_autoload"); /** * Activation and Deactivation */ register_activation_hook( __FILE__, array('mf_install', 'install' ) ); //In wp 3.1 and newer the register_activation_hook is not called //when the plugin is updated so we need call the upgrade //function by hand function mf_update_db_check() { if ( get_option(MF_DB_VERSION_KEY) != MF_DB_VERSION ) { mf_install::upgrade(); } } add_action('plugins_loaded','mf_update_db_check'); //MF in mode plusing multinetwork if( mf_mu2() ){ mf_install::install(); } //Register Post Types and Custom Taxonomies $mf_register = new mf_register(); //Adding metaboxes, and hooks for save the data when is created a new post $mf_post = new mf_post(); if( is_admin() ) { //load_plugin_textdomain($mf_domain , '/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)).'/lang', basename(dirname(__FILE__)).'/lang'); load_plugin_textdomain('magic_fields', '/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)).'/lang', basename(dirname(__FILE__)).'/lang'); //check folders add_action('admin_notices', array('mf_install', 'folders')); //add common function require_once(MF_PATH.'/mf_common.php'); add_action( 'admin_enqueue_scripts', 'mf_enqueue_scripts' ); function mf_enqueue_scripts() { // CSS Files wp_register_style( 'mf_admin_css',MF_BASENAME.'css/mf_admin.css' ); wp_enqueue_style( 'mf_admin_css' ); } // Settings Page add_action( 'admin_menu', 'mf_menu' ); function mf_menu( ) { global $mf_domain; add_options_page(__('Magic Fields Settings', $mf_domain ), 'Magic Fields', 'manage_options', 'mf_settings', array('mf_settings','main') ); } //Administration page add_action('admin_menu','mf_admin'); function mf_admin() { global $mf_domain; add_menu_page('Magic Fields','Magic Fields','activate_plugins','mf_dispatcher','mf_dispatcher',MF_BASENAME.'/images/wand-hat.png'); add_submenu_page('mf_dispatcher', __('import',$mf_domain), __('Import',$mf_domain), 'edit_pages','mf_dispatcher&mf_section=mf_posttype&mf_action=import_form_post_type', 'mf_dispatcher'); } add_action( 'admin_menu', 'hide_panels' ); function hide_panels() { //hidding the post or page panel //accord with the settings if( mf_settings::get('hide_post_panel') ) { mf_admin::mf_unregister_post_type('post'); } if( mf_settings::get('hide_page_panel') ) { mf_admin::mf_unregister_post_type('page'); } } //Adding metaboxes into the pages for create posts //Also adding code for save this data add_action( 'add_meta_boxes', 'mf_add_meta_boxes'); function mf_add_meta_boxes() { } /** * Magic Fields dispatcher */ function mf_dispatcher() { $section = "mf_dashboard"; $action = "main"; //Section if( !empty( $_GET['mf_section'] ) ) { $section = urlencode($_GET['mf_section']); } //Action if( !empty( $_GET['mf_action'] ) ) { $action = urlencode( $_GET['mf_action'] ); } $tmp = new $section(); $tmp->$action(); //call_user_func( array( $section, $action ) ); } /** * Init Hook */ add_action( 'init', 'mf_init' ); function mf_init() { //Sometimes is neccesary execute the mf_dispatcher function in the init hook //because we want use a custom headers or a redirect (wp_safe_redirect for eg) if(!empty($_GET['init']) && $_GET['init'] == "true" ) { mf_dispatcher(); } } //Including javascripts files add_action( 'init', 'mf_add_js'); function mf_add_js() { global $mf_domain; if( is_admin() ) { //this scripts only will be added on the admin area wp_enqueue_script( 'jquery.validate',MF_BASENAME.'js/third_party/jquery.validate.min.js', array( 'jquery' ) ); wp_enqueue_script( 'jquery.metadata',MF_BASENAME.'js/third_party/jquery.metadata.js', array( 'jquery' ) ); wp_enqueue_script( 'mf_admin',MF_BASENAME.'js/mf_admin.js', array( 'jquery.validate', 'jquery.metadata', 'jquery' ) ); if( isset($_GET['mf_action']) && in_array($_GET['mf_action'],array('add_field','edit_field') ) ){ wp_enqueue_script( 'jquery.stringToSlug', MF_BASENAME.'js/third_party/jquery.stringToSlug.min.js', array('mf_admin') ); } //and this scripts only will be added on the post types section if( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == "mf_posttype" ) { wp_enqueue_script( 'mf_posttype', MF_BASENAME.'js/mf_posttypes.js', array('mf_admin') ); } //and this scripts only will be added on the post types section if( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == "mf_custom_taxonomy" ) { wp_enqueue_script( 'mf_taxonomy', MF_BASENAME.'js/mf_taxonomy.js', array('mf_admin') ); } //Adding the files for the sort feature of the custom fields if( ( !empty( $_GET['mf_section'] ) && $_GET['mf_section'] == 'mf_custom_fields' ) && ( !empty( $_GET['mf_action'] ) && $_GET['mf_action'] == 'fields_list' ) ) { wp_enqueue_script( 'mf_sortable_fields', MF_BASENAME.'js/mf_posttypes_sortable.js', array( 'jquery-ui-sortable' ) ); } //Adding Css files for the post-new.php section (where is created a new post in wp) if( strstr( $_SERVER['REQUEST_URI'], 'post-new.php' ) !== FALSE || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post.php') !== FALSE ) { /* Load JS and CSS for post page */ $css_js = new mf_post(); $css_js->load_js_css_base(); $css_js->load_js_css_fields(); $css_js->general_option_multiline(); } } } add_action('wp_ajax_mf_call','mf_ajax_call'); /* estara sera la funcion principal de llamadas js de MF*/ function mf_ajax_call(){ $call = new mf_ajax_call(); $call->resolve($_POST); } add_filter('attachment_fields_to_edit', 'charge_link_after_upload_image', 10, 2); function charge_link_after_upload_image($fields){ if( ( isset($_REQUEST['fetch']) && $_REQUEST['fetch'] ) || ( isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'library' ) ){ printf(" <script type=\"text/javascript\"> //<![CDATA[ load_link_in_media_upload(); //]]> </script>"); } return $fields; } }else{ /* load front-end functions */ require_once( 'mf_front_end.php' ); }
Forum: Plugins
In reply to: [Plugin: Magic Fields] Image Upload conflict with WP 3.5 upgradeHmmm, did you replace the whole main.php code?
Seems like I got an error like that when I copy/pasted their entire new main.php file.
But when I only replaced the small section that they show, it worked just fine.Forum: Plugins
In reply to: [Magic Fields] WordPress image uploader doesn't workI’m not sure – is there a main.php file for version 1?
I don’t know how different they are.
If there is, I’d suggest opening it up and seeing if you can find a line that is similar to what they modified.Or you can hit them up on twitter, they were super fast in responding to me. here’s a link to their site and their twitter/emails:
https://magicfields.org/support/