Forum Replies Created

Viewing 15 replies - 1 through 15 (of 28,300 total)
  • Moderator bcworkz

    (@bcworkz)

    You have limited ability to add content to the user list table. I think you’re better off using the default search box and modifying the search query to get the users you are looking for. Similar to “pre_get_posts”, there is a “pre_get_users” action hook where you can modify the query as desired, but limited to what query vars are available. WP_User_Query accepts meta data query vars similar to what WP_Query does for posts.
    https://developer.www.ads-software.com/reference/classes/wp_user_query/prepare_query/#parameters

    Moderator bcworkz

    (@bcworkz)

    Apparently wrapping text around an image is contrary to the block concept. You wouldn’t expect a physical block to distort itself to wrap around a smaller block, wound you? ?? I’m not saying I support the concept, I’m only speculating about the reasoning behind the choice. It’s conceivable that a different theme has CSS that better supports word wrapping. It’s not necessary to have a different block for this, only different CSS.

    I couldn’t say which themes would better support word wrapping. In any case I don’t think this should be important criteria in selecting a theme. Choose a theme you like best overall. If you need to add some custom CSS to get word wrapping, so be it.

    Moderator bcworkz

    (@bcworkz)

    As you’ve discovered, the nav block does not support styling to that level of detail. You’ll need to add your own custom CSS to get different colors for each item. You can use CSS’ :nth-child() pseudo-selector to target each element individually. You can use your browser’s element inspector tool to help come up with the right CSS. Changes in the inspector do not persist. Once you’ve come up with the right CSS, copy/paste it into the Style Book’s Additional CSS section.

    Moderator bcworkz

    (@bcworkz)

    Be aware that there is some upper limit to how long an URL is. I don’t know what it is, but I doubt your intended message would exceed the allowable length. It probably doesn’t matter since it’s essentially a local link. All that really matters is that your mail client accepts it. FYI

    Collect all variable content from where ever it is saved and assign it all to variables. Compose your message as desired, using the variables where you want the data to appear. Be sure the message is defined with double quotes. Run it through urlencode() and assign the entire string to another variable. Use that variable in the final URL composition. Partial example:

    $owner = get_post_meta( $post->ID, 'owner', true );
    $customer = get_post_meta( $post->ID, 'customer', true );
    $message = urlencode("Dear $owner,
    
    I got the following request:
    
    customer’s name: $customer
    etc....";
    $author_id = $post->post_author;
    $recipient = get_userdata( $author_id )->user_email;
    $actions[email] = "<a href=\"mailto:$recipient?subject=Customer+Request&body=$message\">Send email</a>";

    Line breaks in your message should persist through to the received email message, assuming it is sent as plain text and not HTML. If your message should have any double quotes in it, they will need to be escaped with a backslash \, similar to how the double quotes within the <a> link tag are escaped. This is how PHP can tell the difference between a quote in the message and a quote demarcating the end of the string.

    Moderator bcworkz

    (@bcworkz)

    If you use Dilip’s exact suggestion, the same audio file would used in the appended player for all posts. But if the audio file were added as a custom field, you can modify their suggested code to get the file’s path from post meta (where custom fields are saved). Then each post will have its own audio file in the player.

    I’ll assume you are able to see the custom fields dialog below the main editor field. Under “Add New Custom Field:”, click the “Add new” button and assign a good name for your custom field. It’s best to use a name following post slug name rules: all lower case, no special or accented chars except for -. Maybe audio-file-path? Once you’ve added a name one time, with other posts you can select the same name from the drop down field. It’s important that all posts use the same name for the same use. In the Value field enter the file’s relative path for the current post. Click the “Add custom field” button.

    The file’s path must be relative to the same base URL for all audio files. The base URL would be defined by how you modify Dilip’s code. The file’s full path needs to be passed to the [audio] shortcode. You could do something like this:
    $audio = ‘[audio src="'. content_url('/uploads/audio/'. get_post_meta( get_the_ID(), 'audio-file-path', true )) ."]‘; (untested)

    You might consider first checking if the audio custom field value exists. If not, don’t output the audio player at all.

    If the suggested excerpt filter code fails to expand the shrotcode into an audio player, you probably need to either add a small $priority arg to the add_filter() call, or explicitly pass $audio through do_shortcode()

    Moderator bcworkz

    (@bcworkz)

    You don’t need global $post. $post is passed to your function by the filter hook.

    You should only pass $author_id to get_userdata(). It’s an integer, not an object. The function returns a WP_User object, from which you can get their email. For example:
    $recipient = get_userdata( $author_id )->user_email;

    You’ll probably want to modify subject=request+customer&body=Email+message+body to reflect the subject and message you really want to send.

    Moderator bcworkz

    (@bcworkz)

    It appears the issue isn’t with the slider, but a plugin called JS Composer. I’m not familiar with this plugin, it appears to be an extension for Visual Composer perhaps? Anyway, it is adding CSS code that prevents a full width slider under some circumstances. You could likely add your own custom CSS to negate what the plugin is doing. If you have trouble doing this, I recommend contacting the developers of the plugin through their dedicated support channel for specific advice.

    This plugin appears to also be a commercial product, so there’s little more we can offer for help beyond “it’s a CSS issue with JS Composer”.

    Moderator bcworkz

    (@bcworkz)

    You could hide the login box with CSS, then use JavaScript to toggle the display property between none and block. Example CSS to start with:
    #loginform { display: none; }

    FWIW, it is feasible to create a completely custom login screen independent of wp-login.php. wp_signon() could be called to authenticate and log in a user. You can even do your own authentication as long as the user is set as the current user and their auth cookie is set.

    The WP login screen does more than log in users, there are registration and lost password features. A custom login screen could implement these as well as long as they mimic what wp-login.php does.

    Moderator bcworkz

    (@bcworkz)

    I’m glad you found a solution. FYI, you don’t necessarily need a plugin to utilize custom fields, there’s a built in UI for it. You might have yours hidden. It can be made visible in the editor’s preferences or screen options. Assuming you use either the block (Gutenberg) or classic editors.

    IMO, the default UI for custom fields is rather clunky. For a nicer user experience you might be happier using a plugin such as ACF, but it’s not absolutely necessary.

    Moderator bcworkz

    (@bcworkz)

    Successful alignment depends on the viewport width and the amount of text above the button. When the text all takes up the same number of rows, the buttons align. Different row counts mean mis-alignment. You cannot be sure any random user will always see all text with the same number of rows. If alignment is important to you, you need a different CSS solution.

    Moderator bcworkz

    (@bcworkz)

    Get the author ID from $post, then get the user_email property from the object returned by get_userdata(). Assign it to $recipient.

    Instead of assigning the HTML to $mailto, assign it to $actions[email].

    Moderator bcworkz

    (@bcworkz)

    The WP auto-excerpt function strips out all HTML tags so it can get an accurate word count. Thus you cannot expect audio player embed code to survive the process. If you use the post’s excerpt field, any HTML tags and embed code will be retained. The excerpt field, when populated, will automatically be used instead of the word count auto-excerpt. Of course the drawback is the field will need to be manually defined for every post.

    Or you could maintain the embed code, or at least the audio file’s source URL, in a custom field for each post. Then modify the archive template being used to output this custom field in addition to the usual auto-excerpt of post content. This way you don’t need to manually define the entire excerpt, you just need to provide appropriate data in the custom field.

    Moderator bcworkz

    (@bcworkz)

    One way to get buttons to be consistently positioned is to absolute position them within each item’s overall container, which itself has a fixed height. The problem with fixed height is the desired height may vary depending on viewport width. You will likely need a series of media queries to define a good height at various viewport widths. Thus you’d need to ensure the text components never exceed the height available, or else some text will overflow or be clipped.

    Maybe a better approach would be to use one of the more advanced CSS layout models such as grid or flexbox. They each support an end alignment property that will consistently position the buttons.

    Moderator bcworkz

    (@bcworkz)

    Running a wp-cron task every 60 sec certainly would not cause Woo to run better. If anything, it’s quite the opposite. Without knowing what a cron task is doing every 60 sec, it’s impossible to judge whether running at a longer interval would cause any harm. You could arbitrarily increase the interval, then do some testing to see if there are any adverse effects. If it happens 60 sec is truly necessary and if server Cron is not available for some reason, maybe instead the task could run on the request of whichever pages are affected by the current wp-cron task. Results could be cached for later use in the near future so the task only needs to execute on requests greater than 60 sec apart.

    Moderator bcworkz

    (@bcworkz)

    Your code to add the action link to each post could fetch the recipient’s email address from where ever it is saved and use it to compose a HTML link like so:
    $mailto = "<a href=\"mailto:$recipient?subject=Your+inquiry&body=Email+message+body\">Send email</a>";
    where $recipient is assigned the email address. Subject and body must be URL encoded, that’s why there are + characters instead of spaces. Your mail client will restore the spaces. You can still edit the message before it is sent if so desired. Not possible with a true one click solution.

Viewing 15 replies - 1 through 15 (of 28,300 total)