Cant display custom fields value in frontend + WYSIWYG editor problem with Buddypress

Just installed CustomPress and trying to show the custom field value in the frontend but its resulting a bit difficult.

(**EXTRA ISSUE** YOU WILL NOTICE THERE'S A PROBLEM IN THE LESSON WYSIWYG EDITOR. The cursor gets taken to the first space in every cursor blink. I think this is coming from Buddypress, because on Bp de-activation the issue dissapears. I already asked for the Eduma theme autor for help, but i guess its gonig to take a couple of days for him to answer anything)

Especifically im doing this:

1. Working with "LearnPress" plugin and "Wp Education (Eduma)" Theme, with child theme.
2. Added the text custom field "Forum URL" to the lessons post type.
3. Trying to add a link in every lesson that takes the student to the lesson forum (the link's href should be the custom field value).

The problem is i dont know where should i put the shortcode inside my child theme. Thanks!

Thanks for the help!

  • Cultiva Tus Ideas

    Thanks a lot Rupok!

    1. First of all, what im trying to do is show this field inside every lesson, which are shown via popup in the same course page. (Not trying to show the field in the course page)

    Its been hard for me to find the right place to include the shortcode because it seems the theme is somehow modular.

    Maybe this would help you help me (just to be clear):
    - Every course has lessons as subdivisions and they are shown via popup once you clic on the lesson name in the single course page.
    - Every lesson has its own id but not own slug.
    - I added a Text custom field to the lesson type posts.
    - When i inser the shortcode it does not display anything.

    2. In second place i would like to ask about the second problem which seems to be triggered by BuddyPress: when editing a lesson, the cursor in the WYSIWYG editor gets taken to the first character of the textbox no matter where i clic inside of it.

    Thanks for your valuable help!

    Cristian @ Cultiva Tus Ideas

  • Kasia Swiderska

    Hello Cristian,

    In parent theme file responsible for lessons is eduma/learnpress-v1/lesson/description.php - I tried to edit it and show coursepress custom field there, but it doesn't return anything (not when its used in content or when its added to template) - so this is conflict or there is error that prevents it from working.
    I tested custom fields in custom post type and they were working fine on my site.

    Lets try to debug that first with debug mode. To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add yet one more similar line:

    define( 'WP_DEBUG_LOG', true );

    In this case the errors will be saved to a debug.log log file inside the /wp-content/directory.

    Depending on whether you want your errors to be only logged or also displayed on the screen you should also have this line there, immediately after the line mentioned above:

    define( 'WP_DEBUG_DISPLAY', false );

    The wp-config.php is located in your WordPress root directory. It’s the same file where the database configuration settings are. You will have to access it by FTP or SFTP in order to edit it. I would need then to see contents of the debug.log file - so please paste it to the text file and attach to post.

    2. In second place i would like to ask about the second problem which seems to be triggered by BuddyPress: when editing a lesson, the cursor in the WYSIWYG editor gets taken to the first character of the textbox no matter where i clic inside of it.

    Does this problem occurs when using default WordPress theme like 2016 and BuddyPress? If this is conflict with theme then only theme author can fix it.

    kind regards,
    Kasia

  • Cultiva Tus Ideas

    Thank you so much for this awesomely explained answer Kasia. I followed your steps.

    Now:

    1. I activated debug mode and debug log. The debug display is set to false.

    After many attempts to show the custom field value via content and via template, neither worked nor triggered any php error. Well, at least after all of this there isnt any debug.log inside the /wp-content folder, so i'm guessing there were no errors.

    2. I also followed your advice here and activated twenty sixteen. The problem presists with this theme, so it seems not to be a theme problem.
    *BUT when i activated debug mode for the first problem, this error dissapeared (with WpEducation/Eduma theme active). Meaning, if i have debug mode and debug log set to true and debug display set to false, this cursor problem in the lesson editing backend page is gone. ¿Strange? At least before the eyes of a php newbie (me), it is

    ¿What should i do next?

    We're glad to work with people like you, WPMUdev team. Thanks for your time and extremely valuable experience and knowledge. Thanks again

    Cristian @ Cultiva Tus Ideas

  • Cultiva Tus Ideas

    Hello again my friends.

    Currently the debug.log was created and i uploaded its content here in PDF format. It was impossible to upload it in .txt, i get a [denied mime] message everytime i try to upload a .txt here..

    I would like to also mention that the cursor problem when editing lessons (which custom post type created by learnpress plugin) is happening again. Even though i have not changed things from my last reply to this ticket.

    Hope you can help me soon.

    Cristian @ Cultiva Tus Ideas

  • Kasia Swiderska

    Hello Cristian,

    There are two errors that can cause problems - one is from child theme:

    [20-Jul-2016	02:17:55	Atlantic/Stanley]	PHP	Parse	error:		syntax	error,	unexpected	'function'
    (T_FUNCTION)	in	wp-content/themes/eduma-child/functions.php	on	line	25

    and second is from learnpress

    [20-Jul-2016	16:26:38	Atlantic/Stanley]	Error	Column	'order_id'	cannot	be	null	de	la	base	de
    datos	de	WordPress	para	la	consulta	INSERT	INTO	<code>wp_learnpress_user_courses</code>	(<code>user_id</code>,
    <code>course_id</code>,	<code>start_time</code>,	<code>status</code>,	<code>end_time</code>,	<code>order_id</code>)	VALUES	(1469042130,	5299,	'2016-
    07-20	16:26:38',	'enrolled',	'0000-00-00	00:00:00',	NULL)	/*	From	[eunacom.wpengine.com/wpadmin/post.php]
    in	[wpcontent/plugins/learnpress/inc/user/abstract-lp-user.php:1373]
    */	realizada	por	edit_post,
    wp_update_post,	wp_insert_post,	do_action('save_post'),	call_user_func_array,
    LP_Order_Post_Type->save_order,	LP_Order->update_status,
    do_action('learn_press_order_status_completed'),	call_user_func_array,
    learn_press_auto_enroll_user_to_courses,	LP_Abstract_User->enroll

    other than that, there is lots of notifications from learnpress and BuddyPress. So at the moment those should be reported to theme and plugins authors.

    But try to install previous version of BuddyPress - actual one has one bug that can interfere wish work of other plugins so it worth to try checking if downgrade will help on your site.

    kind regards,
    Kasia

  • Kasia Swiderska

    Hello Cultiva Tus Ideas,

    I'm terribly sorry for delay on our side.

    If by 'using gallery' you mean inserting media in a lesson, i did it and it worked.

    By gallery I meant WordPress Gallery (not single media, because it is not shortcode) - so few images used as gallery

    So output of gallery in text mode is like that [gallery ids="266,197"]

    Did you have a chance to contact that theme authors if they filter those lessons?

    kind regards,
    Kasia