Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
5 posts Page 1 of 1
On the blog section, inside of advanced settings, I have the option "Publish" as standard.

Is there any way to make the option "Not published" as the standard options?

Thank you :)
In the docs on Couch v2.0 (viewtopic.php?f=5&t=10241), under the section "Customizing the Form screen", you'll find a sample that 'mimics' the publish-date region using custom inputs.

Following is a slightly modified version of the sample (with check for a new page (i.e. with id='-1')) -
Code: Select all
<cms:config_form_view>

    <cms:persist
        k_publish_date="<cms:if frm_my_publish_status='0'>0000-00-00 00:00:00<cms:else/><cms:show frm_my_publish_date /></cms:if>"
        _auto_title='1'
    />

    <cms:field 'my_publish_date' label='Publish Date' order='101' group='_advanced_settings_'>
        <cms:input type='radio'
              name='my_publish_status'
              opt_selected="<cms:if k_page_date='0000-00-00 00:00:00' || k_page_id='-1'>0<cms:else />1</cms:if>"
              opt_values='Published=1 | Unpublished=0'
        />
        <div id="my-date-dropdown" style="<cms:if k_page_date='0000-00-00 00:00:00' || k_page_id='-1'>display:none;</cms:if>">
            <cms:input
                name=k_field_input_name
                type='datetime'
                format='mdy'
                fields_separator=','
                default_time="<cms:if k_cur_form_mode='edit' && k_page_date!='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else />@current</cms:if>"
                allow_time='1'
                minute_steps='1'
                required='1'
            />
        </div>
    </cms:field>
   
    <cms:field 'k_publish_date' hide='1' />

    <cms:script>
        $( function(){
            $('#my_publish_status0').on('click', function(e){
                $('#my-date-dropdown').css('display', 'block')
            });
            $('#my_publish_status1').on('click', function(e){
                $('#my-date-dropdown').css('display', 'none')
            });
        });
    </cms:script>

</cms:config_form_view>

Please try using it on the relevant template.
Hope it helps. Do let me know.
Hello again KK,

Thank you, once again, for answering my question :D

I've used the code and it achieved the specific question but there's is only one problem, the hour specification disappeared and every "post" appears the 00:00 as the hours.

I'm sorry.
Not a problem.
I have made the required change to my original code above (just needed allow_time='1' to be set on type 'datetime' region).

Please use the revised code making sure you visit the modified template as super-admin for the change to persist.
The code is perfect now!
I had to increase, just the little bit, the width of the "my-date-dropdown" to put the date and the hour all in the same line.

Thank you for all your help :D
5 posts Page 1 of 1
cron