Dani Llewellyn
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: How to convert this curl request to wp_remote_post()?Hi,
Try the following:
function discordmsg($site, $errorcode, $desc, $webhook, $name){ $msg = json_decode('{ "content": "Monitoring update, read more in the embed below! If you believe a false alarm has been triggered or something has gone wrong, email us ", "embeds": [ { "title": "Uptime Alert", "description": "Your site '.$site.' ('.$name.') is down, Expected response 200/302, Got response '.$errorcode.' (Which means '.$desc.')", "color": 16711680, "footer": { "text": "This was given by the automatic monitoring system provided by example" } } ], "username": "Monitoring Update", "avatar_url": "https://example.com/monitoring/monitoring.png" } ', true); if($webhook != "") { wp_remote_post( $webhook, array( 'payload_json' => json_encode( $msg ) ) ); } }- This reply was modified 5 years, 4 months ago by Dani Llewellyn. Reason: correctly quote payload_json
Forum: Plugins
In reply to: [A-Z Listing] Letters not showing horizontallyThe best place is a new line at the bottom of the file. If there is a
?>on the last line then it needs to go on a new line immediately before the?>.Forum: Plugins
In reply to: [A-Z Listing] Letters not showing horizontallyThe
add_actionneeds to be inserted into your theme’sfunctions.phpfile. I can’t guarantee that it’ll fix your issue, but it’s the only thing I can think to suggest at this point..js.mapfiles are for “Source Maps”. These are special files that your browser can use when you enter the debugger window to show the JavaScript as it appeared before it was minified or transpiled (such as from TypeScript).There is no issue here because when they’re not present resulting in those 404 errors, they do not impact the running of your site. This is because they are only ever loaded when you open the inspector/console/debugger window of your Browser. Therefore their absense isn’t affecting the end-users in any way.
Forum: Plugins
In reply to: [A-Z Listing] Shortcode Not WorkingHi,
Do you want to show posts that are assigned the term “regions”, or do you want to show terms whose parent is “regions”?
For posts which are assigned the term “regions” you want:
[a-z-listing display="posts" post-type="post" taxonomy="category" terms="regions"]For terms whose parent term is “regions” you want:
[a-z-listing display="terms" taxonomy="category" parent-term="regions"]If the listing isn’t showing any results for the relevant shortcode, double check that your term/parent-term has the “slug” of “regions”. If you use the first of the shortcodes above, you should also double-check that there are posts assigned to “regions”.
You might also be able to show posts which have a term nested underneath the “regions” category with:
[a-z-listing display="posts" post-type="post" taxonomy="category" parent-term="regions"]However, I’m not certain that last option works.
Forum: Developing with WordPress
In reply to: WordPress Import Node-modules with javascript problemA browser will emit a CORS policy error like you have seen when you are attempting to load a javascript file off a different hostname to the one being shown in your browser. For example, if you navigate to https://example.com your browser will emit a CORS error if you try to load a javascript file from https://another.example.net because the hostnames differ indicating they are different sites. This is a cross-site-scripting mitigation. To fix you need to either ensure that your javascript files are all loaded from the same hostname as the page being displayed or to ensure that the javascript files are sent from their origin server with a header indicating that your site is allowed to access them. The header in the latter case is
Access-Control-Allow-Originand must be set to the hostname of the page loading the javascript.Forum: Plugins
In reply to: [A-Z Listing] remove alphabetical headingHi,
Yes this is possible. You will need to copy the template file from
wp-content/plugins/a-z-listing/templates/a-z-listing.phpinto your theme (or child theme) atwp-content/themes/your-theme/a-z-listing.php.Once you have a copy of the template you must remove the content of lines 24-28:
<div id="letters"> <div class="az-letters"> <?php $a_z_query->the_letters(); ?> </div> </div>…And lines 63-57:
<div class="back-to-top"> <a href="#letters"> <?php _e( 'Back to top', 'a-z-listing' ); ?> </a> </div>Forum: Plugins
In reply to: [A-Z Listing] How to display only child terms ?The plugin does not include automatic rewriting of your shortcode. If you need your shortcode to be adjusted automatically, you might find there are other ways to achieve what you need such as adding a common parent term instead of rewriting the parent-term parameter or creating a separate taxonomy for the terms instead of using a parent-term.
Forum: Plugins
In reply to: [A-Z Listing] Font size for permalink entriesHi,
You can adjust the size of the links with CSS like:
div.letter-section > ul.az-columns > li { font-size: 1.2em; }Standard CSS units can be used like
em,rem,px, etc.Forum: Plugins
In reply to: [A-Z Listing] How to display only child terms ?Hi,
You can do this with the
parent-termparameter, so something like:[a-z-listing display="terms" taxonomy="countries" parent-term="northern-europe"]Forum: Plugins
In reply to: [A-Z Listing] Letters not showing horizontallyI’m at a loss to explain why it’s working fine when logged-in but failing for anonymous users. The only reason I can think of is your site is serving different code to anonymous/not-logged-in users.
Often such discrepancies are cache-related but it seems we’ve accounted for that with
?ao_noptimize=1testing. It doesn’t look like the page is cached by cloudflare so that isn’t serving an old copy. There might be server-level caches that I’m unable to identify, but it would seem that caches are not the problem here.I really don’t know what else to suggest beyond adding the following code to your theme’s
functions.phpto forcibly load the stylesheet on every request:add_action( 'init', 'a_z_listing_force_enable_styles' );The function
a_z_listing_force_enable_stylesis provided by the plugin, so it should be wired up correctly with that single line.Forum: Plugins
In reply to: [A-Z Listing] Style IssueHi,
You can add spacing between the titles with the following snippet of CSS which I’ll add to the plugin in a future update:
.letter-section ul li { margin: 0 0 0.6em; }Forum: Plugins
In reply to: [A-Z Listing] how search in custom fieldsHi,
You can use the content of the fields when displaying the items, but only the title is considered when sorting the items into alphabetical order. You cannot currently use the values in a/some field(s) as the items in an A-Z listing. Only Posts and Terms are currently supported.
You can, however, use the filter
a_z_listing_pre_index_item_titleto change what the plugin sees as the title of a post based on the custom fields present:add_filter( 'a_z_listing_pre_index_item_title', 'override_a_z_titles', 10, 3 ); function override_a_z_titles( $title, $item, $type ) { if ( $type !== 'posts' ) { return $title; } $new_title = get_field( 'field_name', $item->ID, false ); return $new_title; }Ref for
get_field: https://www.advancedcustomfields.com/resources/get_field/Forum: Plugins
In reply to: [A-Z Listing] not compatible with php7.4 yet?Hi,
Yes, this is currently an issue, but thankfully not breaking your site. I need to release a new version to fix those deprecation notices.
Forum: Plugins
In reply to: [A-Z Listing] How to view current terms?Hi,
I’m not sure what you’re asking for, here. The
termsparameter is not exposed anywhere accessible outside of the plugin itself, so unfortunately I think what you’re asking for isn’t currently possible.