WordPress.org Forums » All Posts https://wordpress.org/support/forum/wp-advanced/feed/ Sun, 11 Dec 2022 03:33:51 +0000 https://bbpress.org/?v=2.7.0-alpha-2 en-US https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16278092 <![CDATA[Reply To: How to Reuse Text Fragments (not blocks)]]> https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16278092 Sun, 11 Dec 2022 01:26:29 +0000 dbareis Thanks for the information, I will use “Shorcutter” (at least for now) as the basic version allows aliases and I don’t have to get anyone to approve a purchase.

A quick summary of the two products:

[wpcode id="4299"]
    Alias Needs Pro version (otherwise random? number like 4299")
    Recently updated, many more users/
    Seems more powerful
    PRO: $99/year for one site (currently $49)
[sc name="streetaddress"][/sc]
    Alias Always lower case
    Alias Free
    Recently updated, less users
    PRO: $25 once off for one site, lifetime support (but: Updates for 1 year)
]]>
https://wordpress.org/support/topic/creating-a-custom-post-type-specifying-its-post-ids/#post-16278055 <![CDATA[Creating a custom post type & specifying its POST IDs?]]> https://wordpress.org/support/topic/creating-a-custom-post-type-specifying-its-post-ids/#post-16278055 Sun, 11 Dec 2022 00:09:47 +0000 miketopher Hello, I’m making a plugin that will register a custom post type and the plugin will also regularly create, or update, posts within that custom post type.

It will integrate with a 3rd party service, via restapi.

When the plugin receives incoming data from the 3rd party it will contain a unique id already, which if its pertaining to a previously created post in my custom post type, the unique ID will remain the same as it did on its first incoming data. I want to use that unique ID to look up previously created posts… to determine if i need to create a new post, or update the existing one.

When I Google this kind of thing I am seeing “don’t change post IDs” etc, and I get that.

But given the context I’ve provided so far, would it be okay if I used the 3rd party’s unique ID and set the post id to their unique ID? They will never ever match another post in my wordpress install, they are pretty long numbers, and I may even include a prefix character to further prevent any kind of duplicate post ID issue..

I want to do this because I believe the lookup by post_id is very high performing vs. using meta tables etc.

I appreciate anyone’s time commenting on this.

]]>
https://wordpress.org/support/topic/how-to-hide-active-menu-links/#post-16277980 <![CDATA[Reply To: How to hide active menu links]]> https://wordpress.org/support/topic/how-to-hide-active-menu-links/#post-16277980 Sat, 10 Dec 2022 22:11:33 +0000 jesterj8 thank you!

]]>
https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16277603 <![CDATA[Reply To: How to Reuse Text Fragments (not blocks)]]> https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16277603 Sat, 10 Dec 2022 17:20:56 +0000 George Appiah If you’re going to create a lot of these “text fragments”, you probably want a dashboard UI to be able to easily add/edit/remove the fragments.

You may write your own little plugin to do this, or use a plugin like Shortcoder or WPCode. I’ve tested both plugins and they both worked out of the box: you give the plugin your text (for inline text, be sure to select HTML or Code editor), and they spew out a shortcode you can use anywhere on your site. And you can generate as many of these shortcodes as you desire.

]]>
https://wordpress.org/support/topic/how-to-add-a-conditional-to-get-the-current-depth-level/#post-16277513 <![CDATA[Reply To: How to add a conditional to get the current depth level of a subcategory]]> https://wordpress.org/support/topic/how-to-add-a-conditional-to-get-the-current-depth-level/#post-16277513 Sat, 10 Dec 2022 16:33:45 +0000 bcworkz Your solution identifies a particular position in your present hierarchy. If that works for you, that’s great.

Let’s say you want the depth into any random branch of the hierarchy. You could use get_ancestors() and count() the results. Something you may find useful at some point in the future.

]]>
https://wordpress.org/support/topic/how-do-i-prevent-wordpress-from-rewriting-my-permalink/#post-16277496 <![CDATA[Reply To: How do i prevent wordpress from rewriting my permalink]]> https://wordpress.org/support/topic/how-do-i-prevent-wordpress-from-rewriting-my-permalink/#post-16277496 Sat, 10 Dec 2022 16:20:13 +0000 bcworkz Between post_link and add_rewrite_rule(), you should be able to have nearly any URL structure you want. The URL does need some constant that a regexp can match. Presumably your prefix is the constant to match.

You do need to flush rewrite rules for the added rule to take effect. This can be done by visiting the permalinks settings page. There is also flush_rewrite_rules(), but it should be called sparingly (like only on plugin activation) because it is computationally expensive to do.

]]>
https://wordpress.org/support/topic/how-to-hide-active-menu-links/#post-16277485 <![CDATA[Reply To: How to hide active menu links]]> https://wordpress.org/support/topic/how-to-hide-active-menu-links/#post-16277485 Sat, 10 Dec 2022 16:09:24 +0000 swayam.tejwani using css


li.current-menu-item{display:none;}
]]>
https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16277419 <![CDATA[Reply To: How to Reuse Text Fragments (not blocks)]]> https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16277419 Sat, 10 Dec 2022 15:14:09 +0000 George Appiah

I also looked at short codes but they also appear to be for blocks.

That’s a definite NO.

Shortcodes were around long before blocks even came into existence. And if you don’t want to use a 3rd-party plugin, creating shortcodes might be the way to go: https://developer.wordpress.org/reference/functions/add_shortcode/

]]>
https://wordpress.org/support/topic/complete-sustainable-and-automated-scaling-anonymization-of-publicly-visible-wp/#post-16276975 <![CDATA[Reply To: Complete, sustainable and automated scaling anonymization of publicly visible WP]]> https://wordpress.org/support/topic/complete-sustainable-and-automated-scaling-anonymization-of-publicly-visible-wp/#post-16276975 Sat, 10 Dec 2022 10:09:19 +0000 t5mlfgk116pmoq Thank you for your kind answer.
Best Regards.

]]>
https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16276406 <![CDATA[How to Reuse Text Fragments (not blocks)]]> https://wordpress.org/support/topic/how-to-reuse-text-fragments-not-blocks/#post-16276406 Fri, 09 Dec 2022 23:57:48 +0000 dbareis What I’d like to do is similar to a #define (in C/C++ etc), and then using that template in many places. I tried Reusable Blocks but I don’t want a block I want to imbed the value inline with other content around it.

The first thing I’d like to do is define a street address somewhere:
#define StreetAddress 12 Xyz St, SomeCity etc

And then use that in a say a paragraph block:
.. blah blah shop at "{{StreetAddress}}".

If the address changes that only needs a single place to be updated. I also looked at short codes but they also appear to be for blocks.

]]>