Home › Forums › General Issues › excessive CPU/mySQL usage
Hi all,
My host (shared hosting) who is pretty reasonable has flagged my account for excessive usage on the shared server. One suggestion is that my custom blog module could be causing issues, because the wp-admin/admin-ajax.php file is flagged as constantly running.
I modified the Blog.php in order to display custom fields contents… and we now have 19 custom fields
here is the code I am using. It triggers in two places in the Blog.php file. Suggestions for improving the display are welcome – I hacked this together and suspect that it is inefficient.
/* INSERT START position for Advanced Custom Fields Content -- aka vendor-links */
$buttons = get_fields(); //get_field('repeater-field-name', 'options')
if( $buttons ) {
echo
'<div class="button-strip et_pb_button_module_wrapper et_pb_button_3_tb_body_wrapper">';
foreach( $buttons as $but_name => $but_value ) {
if( !empty( $but_value ) ) {
$but_label = get_field_object($but_name);
$but_type = $but_label['type'];
if( $but_type == 'url' )
echo
'', $but_label['label'] ,'';
elseif( $but_type == 'text' && $but_name == 'special_button_form' ) {
echo
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="', $but_value ,'">';
echo
'<input type="image" src="https://www.readajs.com/wp-content/uploads/2023/01/checkout-paypal.png" border="0" width="150px" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>';
}
elseif( $but_type == 'text' && $but_name == 'payhip_code' ) {
echo
'Order directly!';
}
elseif( $but_type == 'text' && $but_name == 'preorder_code' ) {
echo
'Pre-Order directly!';
}
}
}
echo
'</div>';
}
/* INSERT FINISH position for Advanced Custom Fields Content -- aka vendor-links */
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.