{"id":39381,"date":"2014-05-31T22:34:25","date_gmt":"2014-05-31T22:34:25","guid":{"rendered":"https:\/\/br.wordpress.org\/support\/topic\/como-trocar-o-titulo-de-um-post-protegido\/"},"modified":"2016-08-06T01:29:06","modified_gmt":"2016-08-06T01:29:06","slug":"como-trocar-o-titulo-de-um-post-protegido","status":"closed","type":"topic","link":"https:\/\/br.wordpress.org\/support\/topic\/como-trocar-o-titulo-de-um-post-protegido\/","title":{"rendered":"Como trocar o t\u00edtulo de um &quot;Post Protegido&quot;"},"content":{"rendered":"<p>Ol\u00e1 galera,<\/p>\n<p>Gostaria da ajuda de voc\u00eas pra fazer uma altera\u00e7\u00e3o no t\u00edtulo do post quando ele est\u00e1 protegido. A altera\u00e7\u00e3o seria a seguinte: quando o artigo est\u00e1 protegido eu quero mostrar no lugar do t\u00edtulo a frase &#8220;Post Protegido!&#8221; e ao informar a senha e desbloquear o post eu quero mudar essa frase pelo t\u00edtulo do artigo em quest\u00e3o.<\/p>\n<p>Acredito que essa modifica\u00e7\u00e3o seja feita no arquivo: <code>\/wp-includes\/post-template.php<\/code>, que \u00e9 aonde se encontram os c\u00f3digos dos artigo protegidos. Por\u00e9m, n\u00e3o estou conseguindo criar essa condicional. Segue o c\u00f3digo que estou usando atualmente:<\/p>\n<pre><code>function get_the_title( $post = 0 ) {\n\t$post = get_post( $post );\n\n\t$title = isset( $post-&gt;post_title ) ? $post-&gt;post_title : &#039;&#039;;\n\t$id = isset( $post-&gt;ID ) ? $post-&gt;ID : 0;\n\n\tif ( ! is_admin() ) {\n\t\tif ( ! empty( $post-&gt;post_password ) ) {\n\n\t\t\t\/**\n\t\t\t * Filter the text prepended to the post title for protected posts.\n\t\t\t *\n\t\t\t * The filter is only applied on the front end.\n\t\t\t *\n\t\t\t * @since 2.8.0\n\t\t\t *\n\t\t\t * @param string $prepend Text displayed before the post title.\n\t\t\t *                        Default &#039;Protected: %s&#039;.\n\t\t\t *\/\n\t\t\t$protected_title_format = apply_filters( &#039;protected_title_format&#039;, __( &#039;&lt;span class=&quot;fa fa-lock&quot;&gt;&lt;\/span&gt;&amp;nbsp;&amp;nbsp;%s&#039; ) );\n\t\t\t$title = sprintf( $protected_title_format, $title );\n\t\t} else if ( isset( $post-&gt;post_status ) &amp;&amp; &#039;private&#039; == $post-&gt;post_status ) {\n\n\t\t\t\/**\n\t\t\t * Filter the text prepended to the post title of private posts.\n\t\t\t *\n\t\t\t * The filter is only applied on the front end.\n\t\t\t *\n\t\t\t * @since 2.8.0\n\t\t\t *\n\t\t\t * @param string $prepend Text displayed before the post title.\n\t\t\t *                        Default &#039;Private: %s&#039;.\n\t\t\t *\/\n\t\t\t$private_title_format = apply_filters( &#039;private_title_format&#039;, __( &#039;Private: %s&#039; ) );\n\t\t\t$title = sprintf( $private_title_format, $title );\n\t\t}\n\t}<\/code><\/pre>\n<p>Se algu\u00e9m puder me ajudar a criar essa condicional&#8230;<br \/>\nAgrade\u00e7o desde j\u00e1!!<\/p>\n","protected":false},"template":"","class_list":["post-39381","topic","type-topic","status-closed","hentry","topic-tag-condicional","topic-tag-protegido","topic-tag-titulo"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/39381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/39381\/revisions"}],"wp:attachment":[{"href":"https:\/\/br.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=39381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}