Custom Portal

Powered by Stripe
Allen Media's customer portal is a secure, online platform that gives clients 24/7 access to their account. From the customer portal, clients can view and download invoices, make payments, and update their contact information. The customer portal is a convenient way for clients to manage their account and stay up-to-date on their invoices and payments. Allen Media is committed to providing our clients with the best possible service. The customer portal is just one way that we're able to provide our clients with the convenience and flexibility they need to manage their account.

Setting a Post Title with a Custom Field

Wed, Sep 14th, 2022

Learn how to set your post title using a custom field in WordPress, and see an example of how this can be done using PHP.

As any WordPress developer knows, custom post types are a great way to extend the functionality of a website. However, there may come a time when a developer wants to use a custom field to set their custom post type title. This code example shows exactly how to do this in WordPress using PHP.

  • First, the developer will need to register the custom field with WordPress.
  • Next, they will need to add the field to their post type.
  • Finally, they will need to add some code to their template file to output the field.

By following these simple steps, developers can easily add a custom field to their custom post type titles.


<?
add_action( 'acf/save_post', 'allen_media_set_title_cpt', 20 );
function allen_media_set_title_cpt ( $post_id ) {
    $post_type = get_post_type( $post_id );
    if ( 'custom_post_type' == $post_type ) {
        $testimonial_field = get_field( 'custom_field', $post_id );
        $title = $custom_field;
        $data = array(
            'ID'         => $post_id,
            'post_title' => $title,
            'post_name'  => sanitize_title( $title ),
        );
        wp_update_post( $data );
    }
}
© 2022 Craig Allen. All rights reserved. Powered by Allen Media